implementation of cppcon2015 David Sankel: Big Projects, and CMake, and Git, Oh My! https://youtu.be/3eH4hMKl7XE
One build will build the project and all dependencies. Only required dependencies are built.
recipe:
in the root CMakeLists.txt :
project(monorepo)
###### add and load monorepo script ########
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
include(mono_repo)
load_all_components()
- for each CMakeLists.txt in your source tree
- use import(dependency) for each dependency u need (before target_link_libraries(target dependency) )
- create a file named component.cmake
- for each target created in CMakeLists.txt
- append "declare_target(target)"
open CMakeCache.txt select any all_XXX_enabled this will add target XXX in build tree and all its dependencies.