title: CMake link_directories from library
body: <p>I'm trying to link to a library from another library using CMake and Xcode.
  This is an issue for any library, but to make things easier to convey, let's use <code>zlib</code> as an example.</p>
  
  <p>This seems to work for executables as follows:</p>
  
  <pre><code>LINK_DIRECTORIES(${LIB_DIR}/zlib/build/)
  ADD_EXECUTABLE(MY_EXECUTABLE ...
  </code></pre>
  
  <p>And it generates an Xcode project with the setting shown below:</p>
  
  <p><img src="https://i.stack.imgur.com/Q0fDH.png" alt="enter image description here"></p>
  
  <p>As you can see, the <code>$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)</code> bit gets added correctly, to the <code>zlib</code> library path.</p>
  
  <p>But if I try to do this:</p>
  
  <pre><code>LINK_DIRECTORIES(${LIB_DIR}/zlib/build/)
  ADD_LIBRARY(MY_LIBRARY ...
  </code></pre>
  
  <p><code>zlib</code> never gets linked to <code>MY_EXECUTABLE</code> when I link it to <code>MY_LIBRARY</code></p>
  
  <p>And <code>TARGET_LINK_LIBRARIES</code> after <code>ADD_LIBRARY</code> allows me to link to <code>zlib</code> from <code>MY_LIBRARY</code> but I have to specify the full path, which won't work as the configuration (Debug, Release, etc) as well as the effective platform (iphoneos, iphonesimulator, etc) are factors.</p>
  
  <p>What I want to do is to have <code>zlib</code> added to the Xcode Library Search Paths, with the <code>$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)</code> bit, as shown above.</p>