I am trying to set a couple of Kconfig settings in my CMakeLists.txt file so that I can make use of some CMakeLists.txt variables.
I have been successful in setting Kconfig variables for MCUboot, however I can't seem to get it to work for the application. Based on the documentation here (https://docs.zephyrproject.org/latest/build/kconfig/setting.html#the-initial-configuration) it seems like anything I set in CMake that begins with CONFIG_ should be added to the initial configuration, but that isn't working.
Here is what I have in my CMakeLists.txt:
cmake_minimum_required(VERSION 3.20.0) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 23) set(CONFIG_SHELL y) ## NOT ADDED TO APPLICATION CONFIGURATION (an test) set(mcuboot_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 y) ## PROPERLY ADDED TO MCUBOOT CONFIG set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/key/witricity_key.pem\") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(my_app VERSION 0.3.3) set(TARGET_NAME app) target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY ) target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c <and the rest of my source files> )
The resulting .config file does not have CONFIG_SHELL=y - in fact, CONFIG_SHELL is not set at all.
Why is this working for some parameters and not others? Is this not supported for the application? If not supported, is there another way to do this? Specifically, I want to pull the version number from the CMake project and use it to version my images for MCUboot XIP. Is there a better way to do that? Maybe I can just have them increment each time they are built?
Thanks for the support!