I wish to control target_compile_definitions based on user presets so that local mods may be tested. (Want_Config_Dump)
In my user preset I’ve added
"configurePresets": [
{
"name": "config-base-local",
"hidden": true,
"displayName": "base Configuration for local machine",
"description": "Default build using Ninja generator",
"inherits":"config-base",
"cacheVariables": {
"CW_STM32F746_LOCAL_REPO_PATH": "${sourceDir}/../../../",
"STM32CUBEF7_LOCAL_REPO_PATH": "${sourceDir}/../../../",
"CMAKE_BUILD_TYPE": "Debug",
"ARM_TOOLCHAIN_BIN_DIR": "C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin",
"GIT_BASH_CMD": "C:/Program Files/Git/usr/bin/bash",
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "TRUE"
},
"Use_CW_Local_repo": true,
"Use_ST_Local_repo": true,
"Want_Config_Dump": false
}
},
In my CMakeLists.txt I’ve added
//Applicaton compile definitions
if (Want_Config_Dump)
set(CFG_DUMP_CTRL “-DWANT_CFG_DUMP=1”)
else()
set(CFG_DUMP_CTRL “-DWANT_CFG_DUMP=0”)
endif()
set(application_compile_definitions
$<$CONFIG:DEBUG:-DDEBUG>
-DUSE_HAL_DRIVER
-DSTM32F746xx
-DSTM32_THREAD_SAFE_STRATEGY=5
-DUSES_RTOS=1
-DconfigCWSTM32F746_USE_CODE_TRACKPOINTS=0
-DUSE_USB_FS
-DconfigCWSTM32F746_USE_DBG_TRIGGERS=15
-DWANT_ATB_PBS=1
-DWANT_LWIP_PLATFORM_OVERRIDES
-DRELEASE=RELEASEB
// If WANT_CFG_DUMP is non-zero the application will not run the main system loop.
//This allows the configuration initialisation to be verified
${CFG_DUMP_CTRL}
-DLOW_LEVEL_IO_MESSAGES
-DWANT_QUEUE_REGISTRY=1
-DWANT_STATMSG_PRINTOUT=1
)
This works but I spent a while trying to do this this generator expressions based on Want_Config_Dump. Is this possible? I tried a few variations and all said it did not evaluate to a known generator expression