title: CMake with multiple subdirectories not compiling
body: <p>My Problem is that CMake is refusing to compile giving the following error:</p>
  
  <pre><code> [orpheus@Poseidon build]$ make 
   sources : /home/orpheus/Projects/Personal/C++/test/testProj/src/helloworld/MyClass.cpp/home/orpheus/Projects/Personal/C++/test/testProj/src/helloworld.cpp
   headers : /home/orpheus/Projects/Personal/C++/test/testProj/include/helloworld/MyClass.hpp
   -- Configuring done
   -- Generating done
   -- Build files have been written to: /home/orpheus/Projects/Personal/C++/test/build
   [ 33%] Building CXX object CMakeFiles/TEST.dir/testProj/src/helloworld/MyClass.cpp.o
   /home/orpheus/Projects/Personal/C++/test/testProj/src/helloworld/MyClass.cpp:1:51: fatal error: testProj/include/helloworld/MyClass.hpp: No such file or directory
    #include "testProj/include/helloworld/MyClass.hpp"
                                                      ^
   compilation terminated.
   make[2]: *** [CMakeFiles/TEST.dir/build.make:63:      CMakeFiles/TEST.dir/testProj/src/helloworld/MyClass.cpp.o] Error 1
   make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/TEST.dir/all] Error 2
   make: *** [Makefile:84: all] Error 2
  </code></pre>
  
  <p>I am relatively new to CMake and have gone through most of the tutorials I can find as well as all the relevant stack overflow questions I could find, however nothing quite seems to cover my particular needs, I did (in my tweaking) stumble across a way where this didnt happen(unfortunately I cant replicate this now), however that gave me a linking error claiming:</p>
  
  <pre><code> c++; fatal error: no input files
  </code></pre>
  
  <p>should I use the <code>include_directory()</code> command rather than <code>set()</code> to add the header files?</p>
  
  <p>I decided on not using the <code>glob()</code> method of adding sources as per the  <a href="https://cmake.org/cmake/help/v3.0/command/file.html" rel="nofollow noreferrer">CMake documentation</a> and have based my solution off of <a href="https://stackoverflow.com/questions/8934295/add-source-in-a-subdirectory-to-a-cmake-project">this thread</a> and a variety of tutorials.</p>
  
  <p>I have the following project structure:</p>
  
  <pre><code>test/
   |
   +--CMakeLists.txt
   +--build/
   |     |----CMakeFiles/
   |     |----etc
   |
   +--testProj/
   |     +----CMakeLists.txt
   |     +----include
   |     |       +----CMakeLists.txt
   |     |       +----helloworld/
   |     |       |        +----CMakeLists.txt
   |     |       |        +----MyClass.hpp  
   |     |
   |     |----src
   |     |     +----helloworld.cpp
   |     |     +----CMakeLists.txt
   |     |     +----helloworld/
   |     |     |       +----CMakeLists.txt
   |     |     |       +----MyClass.cpp
  </code></pre>
  
  <p>files are as follows:</p>
  
  <h2>test/CMakeFiles.txt</h2>
  
  <pre><code> cmake_minimum_required(VERSION 3.6.1)
   project(TEST)
   add_subdirectory(testProj)
   add_executable(${CMAKE_PROJECT_NAME} ${sources} ${headers})
   set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
   set(extraFlags "-Wall -Wextra -Weffc++ -pedantic -pedantic-errors -std=c++14")
   set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${extraFlags})
  </code></pre>
  
  <h2>test/testProj/CMakeLists.txt</h2>
  
  <pre><code> include_directories(include)
   add_subdirectory(src)
   add_subdirectory(include)
   set(sources ${sources} PARENT_SCOPE)
   set(headers ${headers} PARENT_SCOPE)
  </code></pre>
  
  <h2>test/testProj/include/CMakeLists.txt</h2>
  
  <pre><code> include_directories(helloworld)
   add_subdirectory(helloworld)
   set(headers ${headers} PARENT_SCOPE)
  </code></pre>
  
  <h2>test/testProj/include/helloworld/CMakeLists.txt</h2>
  
  <pre><code> set(
      headers
      ${headers}
      ${CMAKE_CURRENT_SOURCE_DIR}/MyClass.hpp
      PARENT_SCOPE
  )
  </code></pre>
  
  <h2>test/testProj/src/CMakeLists.txt</h2>
  
  <pre><code> add_subdirectory(helloworld)
   set(
          sources 
          ${sources} 
          ${CMAKE_CURRENT_SOURCE_DIR}/helloworld.cpp 
          PARENT_SCOPE
   )
  </code></pre>
  
  <h2>test/testProj/src/helloworld/CMakeLists.txt</h2>
  
  <pre><code> set(
      sources
      ${sources}
      ${CMAKE_CURRENT_SOURCE_DIR}/MyClass.cpp
      PARENT_SCOPE
      )
  </code></pre>
  
  <p>please can someone point me in the right direction as i'm about to put my head through the monitor.</p>