I have a project composed of several modules and I would like to use CMake's add_subdirectory function:
Project
+ CMakeLists.txt
+ bin
+ (stuff that depends on lib/)
+ lib
module1
+ CMakeLists.txt
+ (cpp,hpp)
module2
+ CMakeLists.txt
+ (cpp,hpp)
module3
+ CMakeLists.txt
+ (cpp,hpp)
logging.cpp
logging.hpp
These top-level modules are independent from each other, but they all depend on the logging module.
When I move the relevant top-level module code from the root CMakeLists into specific subdirectories, I am not able to compile them with make because the logging module is missing.
Is there a way to program the dependency on the logging module into CMakeLists of the top-level modules, or will it be resolved automatically when calling cmake in the root directory?