diff --git a/cmake/modules/FindHostTools.cmake b/cmake/modules/FindHostTools.cmake index 876a86934b1..1dfce4d3d4a 100644 --- a/cmake/modules/FindHostTools.cmake +++ b/cmake/modules/FindHostTools.cmake @@ -116,4 +116,4 @@ set(HostTools_FOUND TRUE) set(HOSTTOOLS_FOUND TRUE) build_info(toolchain name VALUE ${ZEPHYR_TOOLCHAIN_VARIANT}) string(TOUPPER ${ZEPHYR_TOOLCHAIN_VARIANT} zephyr_toolchain_variant_upper) -build_info(toolchain path VALUE "${${zephyr_toolchain_variant_upper}_TOOLCHAIN_PATH}") +build_info(toolchain path PATH "${${zephyr_toolchain_variant_upper}_TOOLCHAIN_PATH}") diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 94bb6482739..705de97d874 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -182,7 +182,7 @@ set(dts_files if(DTC_OVERLAY_FILE) zephyr_list(TRANSFORM DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE DTC_OVERLAY_FILE_AS_LIST) - build_info(devicetree user-files VALUE ${DTC_OVERLAY_FILE_AS_LIST}) + build_info(devicetree user-files PATH ${DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${DTC_OVERLAY_FILE_AS_LIST} @@ -192,7 +192,7 @@ endif() if(EXTRA_DTC_OVERLAY_FILE) zephyr_list(TRANSFORM EXTRA_DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE EXTRA_DTC_OVERLAY_FILE_AS_LIST) - build_info(devicetree extra-user-files VALUE ${EXTRA_DTC_OVERLAY_FILE_AS_LIST}) + build_info(devicetree extra-user-files PATH ${EXTRA_DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${EXTRA_DTC_OVERLAY_FILE_AS_LIST} @@ -390,6 +390,6 @@ elseif(stderr) endif() endif(DTC) -build_info(devicetree files VALUE ${dts_files}) -build_info(devicetree include-dirs VALUE ${DTS_ROOT_SYSTEM_INCLUDE_DIRS}) -build_info(devicetree bindings-dirs VALUE ${DTS_ROOT_BINDINGS}) +build_info(devicetree files PATH ${dts_files}) +build_info(devicetree include-dirs PATH ${DTS_ROOT_SYSTEM_INCLUDE_DIRS}) +build_info(devicetree bindings-dirs PATH ${DTS_ROOT_BINDINGS}) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 066e0422e49..23c30789b73 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -3596,7 +3596,8 @@ function(topological_sort) endfunction() # Usage: -# build_info(... VALUE ...) +# build_info(... VALUE ... ) +# build_info(... PATH ... ) # # This function populates updates the build_info.yml info file with exchangable build information # related to the current build. @@ -3613,11 +3614,20 @@ endfunction() # ...: One of the pre-defined valid CMake keys supported by build info or vendor-specific. # See 'scripts/schemas/build-schema.yml' CMake section for valid tags. # VALUE ... : value(s) to place in the build_info.yml file. +# PATH ... : path(s) to place in the build_info.yml file. All paths are converted to CMake +# style. If no conversion is required, for example when paths are already +# guaranteed to be CMake style, then VALUE can also be used. function(build_info) + set(convert_path FALSE) set(arg_list ${ARGV}) list(FIND arg_list VALUE index) if(index EQUAL -1) - message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) missing a required argument: VALUE") + list(FIND arg_list PATH index) + set(convert_path TRUE) + endif() + + if(index EQUAL -1) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) missing a required argument: VALUE or PATH") endif() yaml_context(EXISTS NAME build_info result) @@ -3635,6 +3645,15 @@ function(build_info) list(SUBLIST arg_list ${index} -1 values) list(POP_FRONT values) + if(convert_path) + set(converted_values) + foreach(val ${values}) + cmake_path(SET cmake_path "${val}") + list(APPEND converted_values "${cmake_path}") + endforeach() + set(values "${converted_values}") + endif() + if(ARGV0 STREQUAL "vendor-specific") set(type VALUE) else() diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 43e73511768..97086cdf19d 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -98,13 +98,13 @@ set(PARSED_KCONFIG_SOURCES_TXT ${PROJECT_BINARY_DIR}/kconfig/sources.txt) if(CONF_FILE) string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE_EXPANDED}") - build_info(kconfig user-files VALUE ${CONF_FILE_AS_LIST}) + build_info(kconfig user-files PATH ${CONF_FILE_AS_LIST}) endif() if(EXTRA_CONF_FILE) string(CONFIGURE "${EXTRA_CONF_FILE}" EXTRA_CONF_FILE_EXPANDED) string(REPLACE " " ";" EXTRA_CONF_FILE_AS_LIST "${EXTRA_CONF_FILE_EXPANDED}") - build_info(kconfig extra-user-files VALUE ${EXTRA_CONF_FILE_AS_LIST}) + build_info(kconfig extra-user-files PATH ${EXTRA_CONF_FILE_AS_LIST}) endif() zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files SUFFIX ${FILE_SUFFIX}) @@ -360,7 +360,7 @@ endif() if(CREATE_NEW_DOTCONFIG) set(input_configs_flags --handwritten-input-configs) set(input_configs ${merge_config_files} ${FORCED_CONF_FILE}) - build_info(kconfig files VALUE ${input_configs}) + build_info(kconfig files PATH ${input_configs}) else() set(input_configs ${DOTCONFIG} ${FORCED_CONF_FILE}) endif()