extra cmake arguments ignored in SDK 2.7.0 using sysbuild

Hello
In SDK 2.6.xx I used to define an extra CMake argument in the VSCode UI, i.e  "-DMFG=1"
This argument was available when CMakeLists.txt was processed so I could do additional processing i.e
if(MFG)
additional processing..
endif()
This broke in 2.7.0 and higher which use sysbuild
The argument is on the command line generated by VSCode but not available to CMake 
What's the recommended way to make it visible to CMake in SDK 2.7.0 and later that use sysbuild?
Thanks

Andy

Parents Reply Children
  • The doc talks about setting a custom property:

    set_property(TARGET ${SB_CONFIG_NETCORE_IMAGE_NAME} APPEND_STRING PROPERTY CONFIG "CONFIG_CUSTOM_STRING=my_custom_value\n")

    I tried that but when the application CMakeLists.txt is processed the "CUSTOM_CONFIG_STRING" is empty

    Maybe I'm not doing it right. What would be the appropriate syntax? All I need is to make the extra command argument visible to Cmake when the app is built. It is visible to the sysbuild.cmake but it looks like it is not passed to the application CMake and when CMakeLists.txt is processed it is not set

    Yes, I still think it's a bug. It seems that when a user passes a CMake argument it should be visible to all participants of the build process.

  • Found this workaround

    github.com/.../76592

    There is an existing but obscure trick for when you really need some variable to be set before loading Zephyr:

    find_package(Zephyr COMPONENTS extensions basic_settings)
    zephyr_get(USER_VAR)
    # ...
    find_package(Zephyr)




Related