title: Xcode custom build configuration causes "library/file not found" for static libraries
body: <p>I have a workspace with a project which links with the static libraries in another project (which is also in the workspace). It's a problem in <a href="http://www.kobold2d.com" rel="noreferrer">Kobold2D</a> I haven't been able to resolve, even though I understand the cause, and I suppose it's <a href="https://stackoverflow.com/questions/8152573/xcode-4-build-static-library-dependency-with-different-configuration-setting">similar to this question</a>.</p>
  
  <p>The project targets and the static library targets all have the <strong>Debug</strong> and <strong>Release</strong> build configurations. All is well.</p>
  
  <p>Now someone adds a new build configuration in the project and names it <strong>Ad-Hoc</strong> for example. Now the project's target builds the <strong>Ad-Hoc</strong> configuration, however the static libraries have no such configuration. Apparently they then default to building the <strong>Release</strong> configuration.</p>
  
  <p>At the end, when the linker is supposed to bring everything together, it fails:</p>
  
  <pre><code>ld: library not found for -lbox2d-ios
  Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ failed with exit code 1
  </code></pre>
  
  <p>For forcibly loaded libraries via <code>-force_load $(BUILT_PRODUCTS_DIR)/libSomeLib.a</code> the error is similar but says "file not found". I should note that the library "libbox2d-ios.a" is in the "link binary with libraries" build phase list.</p>
  
  <p>Obviously the problem is that the linker is assuming that the libraries are in the <strong>Ad-Hoc-iphoneos</strong> folder in the BUILT_PRODUCTS_DIR while they are actually in the <strong>Release-iphoneos</strong> folder because they have no <strong>Ad-Hoc</strong> build configuration.</p>
  
  <p>How can I slap the linker in the face and tell him to get the libraries where they are? Preferably I'm looking for a solution that works for both cases, ie libraries added the standard way (link binary with libraries build phase) and libraries that need an additional -force_load to work.</p>
  
  <p>I'm hoping that there's some way to:</p>
  
  <ul>
  <li>force libraries to be placed in the build configuration folder of the app's target</li>
  <li>run a post-compile &amp; pre-link script that copies each library to the build configuration folder</li>
  <li>specify a relative path to the libraries</li>
  <li>use a different macro other than $BUILT_PRODUCTS_DIR for -force_load</li>
  <li>a linker flag like -WTFmake-all-problems-go-away</li>
  </ul>
  
  <p>Excuse me, but I have to say this … <strong>ARGH!</strong> :)</p>