Helping colleagues familiar with make come over to cmake

Question 1: Aside from doing exactly what you’re doing, I don’t personally know another way. Perhaps specific generators like Unix Makefiles might give you some extra options, but you lose the performance and portability improvements of being able to use other generators like Ninja, which is pretty fast. There’s always, I suppose, the possiblility of creating a CMake project for each subproject and then using the ExternalProject method, although having never used it personally I can’t give any specifics on how to use it for your use-case.

Question 2: If you have a small closed set of standard build workflows (e.g. configure-release/build/install vs configure-debug/build/test/install or whatever), you could add workflows into your CMakePresets file and then invoke cmake like cmake --workflow <workflow>. That does mean that re-running e.g. the install step will require re-running all the steps, so tests will be unskippable unless you make another workflow that specifically skips tests. Also, workflows seem to be meant for stuff like CI/CD and are therefore highly restrictive, so you can’t mix-and-match: you can’t have the release-build preset in a workflow whose configure is the debug-configure, and you also can’t have a single build preset that works for both the release-workflow and debug-workflow, or whatever you want to call them.

1 Like