cmake: support PATH argument in build_info()
Support PATH argument in build_info() function. The PATH argument can be used to provide a list of paths paths and that those paths might be using native style, such as `c:\win\path', and therefore should be converted to CMake style path. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
121cb49a46
commit
a5cd46b843
1 changed files with 21 additions and 2 deletions
|
@ -3658,7 +3658,8 @@ function(topological_sort)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# build_info(<tag>... VALUE <value>...)
|
# build_info(<tag>... VALUE <value>... )
|
||||||
|
# build_info(<tag>... PATH <path>... )
|
||||||
#
|
#
|
||||||
# This function populates updates the build_info.yml info file with exchangable build information
|
# This function populates updates the build_info.yml info file with exchangable build information
|
||||||
# related to the current build.
|
# related to the current build.
|
||||||
|
@ -3675,11 +3676,20 @@ endfunction()
|
||||||
# <tag>...: One of the pre-defined valid CMake keys supported by build info or vendor-specific.
|
# <tag>...: 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.
|
# See 'scripts/schemas/build-schema.yml' CMake section for valid tags.
|
||||||
# VALUE <value>... : value(s) to place in the build_info.yml file.
|
# VALUE <value>... : value(s) to place in the build_info.yml file.
|
||||||
|
# PATH <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)
|
function(build_info)
|
||||||
|
set(convert_path FALSE)
|
||||||
set(arg_list ${ARGV})
|
set(arg_list ${ARGV})
|
||||||
list(FIND arg_list VALUE index)
|
list(FIND arg_list VALUE index)
|
||||||
if(index EQUAL -1)
|
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()
|
endif()
|
||||||
|
|
||||||
yaml_context(EXISTS NAME build_info result)
|
yaml_context(EXISTS NAME build_info result)
|
||||||
|
@ -3697,6 +3707,15 @@ function(build_info)
|
||||||
list(SUBLIST arg_list ${index} -1 values)
|
list(SUBLIST arg_list ${index} -1 values)
|
||||||
list(POP_FRONT 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")
|
if(ARGV0 STREQUAL "vendor-specific")
|
||||||
set(type VALUE)
|
set(type VALUE)
|
||||||
else()
|
else()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue