title: CMake include_directories vs file GLOB
body: <p>I've been trying to migrate a project from VS to CMake, but I'm not sure my project structure is quite fit to a simple migration:</p>
  
  <pre><code>project/
  |- CMakeLists.txt
  |- build/
      |- (cmake stuff)
  |- src/
      |- main.cpp
      |- tests.cpp // also contains a main()
      |- class1.hpp
      |- class1.cpp
      |- class2.hpp
      |- class2.cpp
      |- ...
  |- included/
      | - (external libs)
  </code></pre>
  
  <p>My CMakeLists.txt attempt so far has been:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
  set(CMAKE_LEGACY_CYGWIN_WIN32 0)
  
  add_executable(webnectar src/main.cpp
                           src/test.cpp)
  
  enable_testing()
  add_test(tests project)
  
  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
  include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/included)
  </code></pre>
  
  <p>But I get linking errors with my own classes., I don't understand why.</p>
  
  <p>In several other SO questions I've seen people using file GLOBs to include all sources from a subfolder, which I guess would be a solution. Still, I wish I understood why <code>include_directories</code> is not enough and why (if it would work) file GLOB is OK.</p>
  
  <p>Also, using file GLOB would mess with my build because both test.cpp and main.cpp have a main function.</p>
  
  <p>Although it would look like a different matter (for a different question), please consider this question as more general in the sense of how could I fix all these issues with either a CMake syntax or with a more suitable file structure.</p>