Hello cmake noob here.
I have a project where I would like to build an executable for various products that have different settings.
Folder looks a bit like
bin (folder where final binaries are stored) e.g. main.0.debug.out, main.1.debug.out main.0.release.out, main.1.release.out
lib (folder where libraries are stored) e.g. common.a
cmake_bin (out of source build)
src
– common source code
– product0 - settings.c
– product1 - settings.c
The idea is that you only have to build the time consuming library once and only link the small settings files for different builds to improve the build speed. Also I wouldn’t mind being able to have both CMAKE_BUILD_TYPE=Debug and Release for each of these products.
What is the recommended way to do this?
Should I have separate CMakeLists.txt for each product?
Should I have custom CMAKE_BUILD_TYPE’s Debug_Product0, Debug_Product1, Release_Product0, Release_Product1? Then do I run cmake once for each type?
I have read https://cmake.org/cmake/help/latest/guide/tutorial/index.html#id19 and it seems to indicate a separate cmake_bin for each build type. Can you help me delineate my thinking?
Many thanks,
Sat