title: Cmake cannot find library using "link_directories"
body: <p>I Ubuntu, I am learning about cmake and make, and just trying a simple example. I have two directories: <code>src</code> and <code>build</code>. In <code>src</code>, I have two files: <code>main.cpp</code>, and <code>CMakeLists.txt</code>, which has (only) the following text:</p>
  
  <pre><code>add_executable(test main.cpp)
  link_directories(/usr/lib/x86_64-linux-gnu)
  target_link_libraries(test protobuf)
  </code></pre>
  
  <p>In <code>/usr/lib/x86_64-linux-gnu</code>, there is a shared library called <code>libprotobuf.so</code>, which I want to link against. My <code>main.cpp</code> uses functions in this library, by including the releveant header file, <code>#include &lt;google/protobuf/message.h&gt;</code>.</p>
  
  <p>Now, in my <code>build</code> directory, I run <code>cmake ../src</code>, and then <code>make</code>. However, I then get linker errors telling me that there are undefined references to some of the functions in the protobuf library. If I do a search through all the files and subdirectories in <code>build</code>, there is not mention of anything related to protobuf.</p>
  
  <p>However, if I remove the <code>link_directories</code> line in my <code>CMakeLists.txt</code> file, and instead write the full path to the library when specifying the executable, i.e. <code>target_link_libraries(test /usr/lib/x86_64-linux-gnu/libprotobuf.so)</code>, it compiles and links fine.</p>
  
  <p>Why is <code>link_directories</code> not allowing cmake to find this library?</p>