title: CMake link library from subdirectory
body: <p>I am trying to include SFML sources in my project. My directories are laid out like this:</p>
  
  <pre><code>main
    SFML (subtree synced with the official git repo)
    src
      &lt;various modules&gt;
      General (here lies the binary)
  </code></pre>
  
  <p>From the main level I am adding SFML subdirectory first and then src. As I've seen looking at the build log, this produces libraries:</p>
  
  <pre><code>sfml‑system
  sfml‑window
  sfml‑network
  sfml‑graphics
  sfml‑audio
  sfml‑main
  </code></pre>
  
  <p>Now I want to link them to my binary in the General directory like this:</p>
  
  <pre><code>add_executable(main ${main_SRCS})
  target_link_libraries (main
    sfml‑system
    sfml‑window
    sfml‑network
    sfml‑graphics
    sfml‑audio
    sfml‑main
    # Other stuff here
  )
  </code></pre>
  
  <p>But I get:</p>
  
  <pre><code>/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑system
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑window
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑network
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑graphics
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑audio
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsfml‑main
  </code></pre>
  
  <p>Why does CMake try to use system libraries instead of those it just built and how do I fix this?</p>