title: How to include source file into Bool.Test case from other directory tree?
body: <p>This is somehow a follow-up question to my previous one: <a href="https://stackoverflow.com/q/9302777/588243">How to achieve organisation of test suites and cases with Boost?</a></p>
  
  <p>The directory structure is as stated in the other question and I'm following the therein described organisation of the Boost.Test cases as well.</p>
  
  <p>However, I'm struggling with getting everything to work with CMake.</p>
  
  <p>My <code>tests/CMakeLists.txt</code> is as follows:</p>
  
  <pre><code># tests/CMakeLists.txt
  # Add the test sources
  set(test_SOURCES ${PROJECT_SOURCE_DIR}/tests/TestRunner.cpp)
  
  # Add test cases
  add_subdirectory(model)
  
  # Include Boost and program's sources (find_package has been executed before)
  include_directories(${Boost_INCLUDE_DIR})
  
  # Create the tests
  add_executable(MyProgramTests ${test_SOURCES})
  
  # Link agains Boost libraries
  target_link_libraries(MyProgramTests ${Boost_LIBRARIES})
  </code></pre>
  
  <p>and <code>tests/model/CMakeLists.txt</code> says:</p>
  
  <pre><code># tests/model/CMakeLists.txt
  include(${PROJECT_SOURCE_DIR}/src/model/CMakeLists.txt)
  
  # Add test cases to the list
  set(test_SOURCES
    ${test_SOURCES}
    ${model_SOURCES}
    ${PROJECT_SOURCE_DIR}/tests/model/model_a_test.cpp
    PARENT_SCOPE
  )
  </code></pre>
  
  <p>In <code>src/model/CMakeLists.txt</code> I've just written:</p>
  
  <pre><code>set(model_SOURCES ${PROJECT_SOURCE_DIR}/src/model/model_a.cpp)
  </code></pre>
  
  <p>How do I have to include the <code>src/model/model_a.cpp</code> in my <code>tests/model/model_a_test.cpp</code> so the compiled finally finds it? I tried with <code>#include "src/model/model_a.cpp"</code>, <code>#include "model/model_a.cpp"</code> and even just <code>#include "model_a.cpp"</code>. In all cases the <code>model_a.cpp</code> could not be found.</p>
  
  <p>I'm pretty sure, I'm missing something in the CMakeLists files. But what?</p>
  
  <h2>Edit</h2>
  
  <p>I finally solved it by adding the program's source directory <code>${PROJECT_SOURCE_DIR}/src/model</code> to the <code>include_directories</code> command in <code>tests/CMakeLists.txt</code>. With this, <code>#include "model_a.cpp"</code> should be used.</p>