title: Linking with CMakeLists: ld cannot find library
body: <p>I have a <code>CMakeLists.txt</code> file, with the following:</p>
  
  <pre><code>target_link_libraries(${PROJECT_NAME} OpenNI2)
  </code></pre>
  
  <p>When I run <code>cmake</code>, I receive no errors. But when I run <code>make</code>, I receive the following error:</p>
  
  <pre><code>/usr/bin/ld: cannot find -lOpenNI2
  </code></pre>
  
  <p>However, I have a file called <code>libOpenNI2.so</code> in my build directory. So why can <code>ld</code> not find this? I thought that the build directory was on the search path for <code>target_link_libraries</code>?</p>
  
  <p>Thanks!</p>