I have multiple projects that have identical/duplicated code in their respective CMakeLists.txt. At the very least I need a place to store string definitions that I can pull into the CMakeLists.txt files. What's the best way to do this? My directory structure
common_defs/
src_files
hdr_files
CMakeLists.Txt - file that has common defs
independent_dir1/
src_files
hdr_files
CMakeLists.Txt --> Imports/Includes from ../common_defs/CMakeLists.txt
independent_dir2/
src_files
hdr_files
CMakeLists.Txt --> Imports/Includes from ../common_defs/CMakeLists.txt
independent_dir1 and independent_dir2 will be built independently from each other. Building in common_defs should not trigger builds in the independent_dirs
add_subdirectoryand related functions.add_subdirectorydoesn't quite get me there, because I need independent builds.includeto include common cmake code. But honestly, i think we dont entirely understand your problem. What do you mean with pull?includewill do it. WRT "pull" I'm not sure what to call it, I can see why it's confusing. I mean that the independent_dir*/CMakeLists files should include/import the common code from the common_defs/CMakeLists.txt file