# 1cmake -S . -B ../build1 -D MYOPTION=ON# 2cmake -S . -B ../build2 -D MYOPTION=OFF
option(MYOPTION "Some bool option" OFF)# ...if(MYOPTION) add_subdirectory(extra_target1_dir) add_subdirectory(extra_target2_dir) add_compile_definitions(MYOPTION=1)else() add_subdirectory(extra_target3_dir)endif()
{ "version": 3, "cmakeMinimumRequired": { "major": 3, "minor": 22, "patch": 0 }, "configurePresets": [ { "name": "Client", "description": "Build only one project Client", "generator": "Ninja", "binaryDir": "build-client", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": { "type": "STRING", "value": "ON" }, "BOARD": { "type": "STRING", "value": "<default>" }, "BUILD_CLIENT": { "type": "STRING", "value": "ON" }, "CMAKE_BUILD_TYPE": { "type": "STRING", "value": "Debug" } } } ]}