title: cmake link to shared libraries without using full path
body: <p>I have following CMakeLists.txt:</p>
  
  <pre><code>set( PROJECT_LINK_LIBS lib1.so lib2.so )
  link_directories( path/to/libs ) # lib1.so and lib2.so are there.
  
  add_library( ${PROJECT_NAME} SHARED ${PROJECT_SOURCES} )
  target_link_libraries( ${PROJECT_NAME} ${PROJECT_LINK_LIBS} )
  </code></pre>
  
  <p>Which compiles and links fine.</p>
  
  <p>But when I do:</p>
  
  <pre><code>ldd -d mylib.so
  </code></pre>
  
  <p>I get:</p>
  
  <ol>
  <li><code>libc.so.6 =&gt; /lib/i386-linux-gnu/libc.so.6 (0xf529b000)</code></li>
  <li><code>linux-gate.so.1 =&gt;  (0xf777a000)</code></li>
  <li><code>/lib/ld-linux.so.2 (0xf777b000)</code></li>
  <li><code>lib1.so =&gt; /path/to/libs/lib1.so (0xf56a2000)</code></li>
  <li><code>lib2.so =&gt; /path/to/libs/lib2.so (0xf548f000)</code></li>
  </ol>
  
  <p>My questions are:</p>
  
  <ul>
  <li><strong>How to remove /path/to/libs/ for 4. and 5.?</strong> Something to do with LD_LIBRARY_PATH?</li>
  <li><strong>Auto-answered:</strong> I get what means 1. Search for libc.so.6 in that path. But what about 2. and 3.? <code>locate linux-gate.so.1</code> gives nothing. Why 3. has no => symbol? (found answer <a href="https://stackoverflow.com/questions/19981862/what-are-ld-linux-so-2-and-linux-gate-so-1">here</a>)</li>
  </ul>