I have the following directory structure
- CMakeLists.txt
- include
- a.hh
- lib
- CMakeLists.txt
- a.cc
- src
- CMakeLists.txt
- main.cc
- test
- CMakeLists.txt
- test.cc
I am using CMake for compiling test.cc using the command
add_executable(test test.cc $<TARGET_OBJECTS:A>)
and the object file A.o
is compiled as
add_library(A OBJECT A.cc)
but the $<TARGET_OBJECTS:A>
command becomes ugly very quickly. Is there any way to tell CMake to include all .o
files in the lib folder for linking everything?