title: How to force CMake to link to system library instead of target with same name
body: <p>I have a library with the same name as a system library. Most of the executables in my project link to my own library but one executable needs to link to the system library. CMake is generating a g++ command line linking to ../foo/libfoo.a and I need it to link to -lfoo instead.</p>
  
  <p>I have a structure something like this:</p>
  
  <p>/CMakeLists.txt</p>
  
  <pre><code>add_directory(foo)
  add_directory(program)
  </code></pre>
  
  <p>/foo/CMakeLists.txt</p>
  
  <pre><code>add_library(foo foo.cpp)
  </code></pre>
  
  <p>/program/CMakeLists.txt</p>
  
  <pre><code>add_executable(program program.cpp)
  target_link_libraries(program foo)
  </code></pre>
  
  <p>One solution would be to change the name of my library so it doesn't conflict but I'd rather not do that because reasons. I'm looking for some CMake magic to let me tell it to use the system library.</p>