How can i link an entire folder into a library ?
i have to following structure
src/main.cpp
src/alg/alg1.cpp
src/alg/alg1.hpp
src/alg/alg2.cpp
src/alg/ ...
src/utils/something.cpp
src/utils/...
i could just use
add_library(ALG1 alg/alg1.cpp)
add_library(ALG2 .... )
......
add_library(UTIL1 utils/something.cpp)
add_executable(PROG main.cpp)
target_link_libraries(PROG ALG1 ALG2 ... UTIL1 UTIL2 ...)
anyway to tell it to pack the entire folder and link it ?
also some migth have deps between them
Would the following suit your needs?
Note that it’s not recommended to use commands like
file(GLOB ...)to collect source files, because then the build system will not regenerate if you add a file to the directory.