I have several projects consisting of a few libraries, each living in its own subdirectory, knitted together by the topmost CMakeLists.txt
file. I am in the habit of using project(<DIRNAME>)
at the top of each CMakeLists.txt
file and I try to structure the subprojects in such a way that they could be compiled separately from the top project. However, while this might make sense for standalone, core libraries, it cannot work for the libraries that depend on them because I need to do stuff like
target_link_libraries(gui core)
And core
will nor be defined if I am trying to compile gui
as a standalone project.
Is it wrong to use project()
in this context, or am I missing something?