title: cmake: figuring out which libraries is a binary target linked against
body: <p>I wand to implement in CMake a functionality that would enable the installation of a single binary/target through a <code>make install-TARGET</code> command. This is fairly straightforward to do with a custom target. However, when the target binary in question is linked dynamically against other libs of the project (<code>BUILD_SHARED_LIBS=ON</code>), I need to install the receptive libs as well. Is there any way to somehow query the list of libraries? </p>
  
  <p>I've looked at the target properties, but haven't found anything relevant. </p>
  
  <p>Tips on how to get the list of libs and/or other ways to implement the above described functionality would be very much appreciated! </p>
  
  <p><em>[Edit]</em></p>
  
  <p><strong>Example:</strong><br>
  Let's assume that there the project <code>MyProj</code> has a CMake target "myprog" which generates the binary <code>myprog</code>. I want to install <em>only</em> this binary with <code>make install-myprog</code>. However <code>myprog</code> links against <code>libmy1.so</code> and the latter links against <code>libmy2.so</code>, both part of <code>MyProj</code>. 
  I need a mechanism to figure out that I need to install both <code>libmy1.so</code> and <code>libmy2.so</code> along <code>myprog</code>.</p>