Skip to content

Commit 45c369f

Browse files
57300jhedberg
authored andcommittedOct 11, 2023
sysbuild: Support SB_CONF_FILE and SB_EXTRA_CONF_FILE as lists
These variables need to be converted to absolute paths internally, but so far this has only worked when each value consisted of a single path. Add a common loop to handle lists of paths. As a bonus, run `string(CONFIGURE)` to expand those variables in the same way as the regular CONF_FILE and EXTRA_CONF_FILE. Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
1 parent 3ee0f30 commit 45c369f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed
 

‎share/sysbuild/cmake/modules/sysbuild_kconfig.cmake

+13-12
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,23 @@ else()
2424
# SYSBuild dedicated configuration file.
2525
endif()
2626

27-
if(DEFINED SB_CONF_FILE AND NOT IS_ABSOLUTE SB_CONF_FILE)
28-
cmake_path(ABSOLUTE_PATH SB_CONF_FILE BASE_DIRECTORY ${APP_DIR})
29-
endif()
30-
31-
if(DEFINED SB_OVERLAY_CONFIG AND NOT IS_ABSOLUTE SB_OVERLAY_CONFIG)
32-
cmake_path(ABSOLUTE_PATH SB_OVERLAY_CONFIG BASE_DIRECTORY ${APP_DIR})
33-
endif()
34-
35-
if(DEFINED SB_EXTRA_CONF_FILE AND NOT IS_ABSOLUTE SB_EXTRA_CONF_FILE)
36-
cmake_path(ABSOLUTE_PATH SB_EXTRA_CONF_FILE BASE_DIRECTORY ${APP_DIR})
37-
endif()
38-
3927
if(NOT DEFINED SB_EXTRA_CONF_FILE AND DEFINED SB_OVERLAY_CONFIG)
4028
set(SB_EXTRA_CONF_FILE ${SB_OVERLAY_CONFIG})
4129
endif()
4230

31+
# Let SB_CONF_FILE and SB_EXTRA_CONF_FILE be relative to APP_DIR.
32+
# Either variable can be a list of paths, so we must make all of them absolute.
33+
foreach(conf_file_var SB_CONF_FILE SB_EXTRA_CONF_FILE)
34+
if(DEFINED ${conf_file_var})
35+
string(CONFIGURE "${${conf_file_var}}" conf_file_expanded)
36+
set(${conf_file_var} "")
37+
foreach(conf_file ${conf_file_expanded})
38+
cmake_path(ABSOLUTE_PATH conf_file BASE_DIRECTORY ${APP_DIR})
39+
list(APPEND ${conf_file_var} ${conf_file})
40+
endforeach()
41+
endif()
42+
endforeach()
43+
4344
if(DEFINED SB_CONF_FILE AND NOT DEFINED CACHE{SB_CONF_FILE})
4445
# We only want to set this in cache it has been defined and is not already there.
4546
set(SB_CONF_FILE ${SB_CONF_FILE} CACHE STRING "If desired, you can build the application with \

0 commit comments

Comments
 (0)
Please sign in to comment.