How to add files from subdirectories ?
Opened this issue · 0 comments
skipit commented
I was trying to extend this, by adding a directory and a cpp file in that directory and a test_*.cpp file in that directory and add it.
I used the add_subdirectory(another_dir) directive, and inside that, I added lines
1 include_directories(${CMAKE_SOURCE_DIR})
2 include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
3 add_library(another_dir test_project2.cpp)
It compiles fine.
On the toplevel CMakeLists.txt I added, target_link_library(.... , another_dir).
This was not linking the library from the subdirectory.
Can you update this git-repo on how to handle subdirectories.