title: CMake: Attempted to add link library to target which is not built in this directory
body: <p>I'm having a an issue compiling some unit tests in my cmake project. The idea is to add these boost unit tests as executables, so that I can then run them. Anyway I'm getting this error that I don't quit understand, which is saying that I cannot link my cpp unit tests which must be linked to test the library I built. The two unit tests I'm trying to link and add as executables are, DownloadTickers.cpp and GetTickersForLetter.cpp.</p>
  
  <p>My directory structure is as follows:</p>
  
  <pre><code>&gt; Algo
    &gt; build (this is where I do: cmake .. which gives me errors)
    -CMakeLists.txt (top level cmake)
    -algo.h.ini
    -run.cpp
    &gt; NetworkModule
     &gt; CrawlTickers
      -CMakeLists.txt
      -CrawlTickers.cpp
      -CrawlTickers.hpp
      &gt; tests
       -CMakeLists.txt
       -DownloadTickers.cpp
       -GetTickersForLetter.cpp
  </code></pre>
  
  <p>The CMakeLists.txt for Algo is:</p>
  
  <pre><code>cmake_minimum_required (VERSION 2.8)
  project (Algo)
  
  set (Algo_VERSION_MAJOR 0)
  set (Algo_VERSION_MINOR 1)
  set (CMAKE_CXX_COMPILER g++-4.8)
  set (CMAKE_BUILD_TYPE Release)
  
  add_definitions(
    -std=c++11
  )
  
  configure_file(
    "${PROJECT_SOURCE_DIR}/algo.h.in"
    "${PROJECT_BINARY_DIR}/algo.h"
  )
  
  include_directories("${PROJECT_BINARY_DIR}")
  
  add_subdirectory(NetworkModule/CrawlTickers)
  
  add_executable(Run run.cpp)
  </code></pre>
  
  <p>The CMakeLists.txt for CrawlTickers is:</p>
  
  <pre><code>find_package(Boost COMPONENTS system filesystem unit_test_framework REQUIRED)
  
  add_library(CrawlTickers SHARED CrawlTickers.cpp)
  
  add_subdirectory(tests)
  
  target_link_libraries(
    CrawlTickers
    cpprest
  )
  
  target_link_libraries(
    DownloadTickers
    CrawlTickers
    ${Boost_FILESYSTEM_LIBRARY}
    ${Boost_SYSTEM_LIBRARY}
    ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
  )
  
  target_link_libraries(
    GetTickersForLetter
    CrawlTickers
    ${Boost_FILESYSTEM_LIBRARY}
    ${Boost_SYSTEM_LIBRARY}
    ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
  )
  </code></pre>
  
  <p>The CMakeLists.txt for tests is:</p>
  
  <pre><code>add_executable( DownloadTickers DownloadTickers.cpp )
  
  add_executable( GetTickersForLetter GetTickersForLetter.cpp )
  </code></pre>
  
  <p>My thinking is that cmake would naturally register DownloadTickers and GetTickersForLetter as executables in the CrawlTickers CMakeLists.txt and then know how to link it to the target, but I have no idea why I'm getting this error. Any help is greatly appreciated. Thanks.</p>