title: Properly manage shared libraries with CMake
body: <p>I'm trying to link a cmake build with two shared libraries, linking occurs but <code>RPATH</code> is pointing to an absolute path of one of the two libraries while <code>readelf</code> output is incorrect for the other.</p>
  
  <p>What I did is the following:</p>
  
  <pre><code>add_library(foo SHARED IMPORTED)
  set_target_properties(foo 
    PROPERTIES IMPORTED_LOCATION ${LIBS_DIRECTORY}/foo/libfoo.so
  )
  
  add_library(bar SHARED IMPORTED)
  set_target_properties(bar
    PROPERTIES IMPORTED_LOCATION ${LIBS_DIRECTORY}/foo/libbar.so
  )
  
  target_link_libraries(myprogram foo bar)
  </code></pre>
  
  <p>This works and linking occurs but readelf prints the following:</p>
  
  <pre><code>0x0000000000000001 (NEEDED)             Shared library: [../../../libs/foo/libfoo.so]
  0x0000000000000001 (NEEDED)             Shared library: [libbar.so]
  0x000000000000000f (RPATH)              Library rpath: [/home/user/test/trunk/libs/foo:/home/user/test/trunk/libs/bar]
  </code></pre>
  
  <p>So basically one of the two libs (but just one, and it makes no sense) has an absolute path while rpath contains both the full paths (which is not what I want to do, since I want to ship the executable with the two libraries in the same folder of the exectuable (or a subfolder at most).</p>
  
  <p>Am I missing something trivial?</p>