Skip to content

Commit 8b3d4c6

Browse files
tejlmandfabiobaltieri
authored andcommitted
cmake: update zephyr_file to use cmake_path()
Since the introduction of zephyr_file() then the minimum required CMake version has become 3.20. Update zephyr_file() to use cmake_path insteasd of set(). This allows us to normalize the path and thereby also remove duplicates in the list as paths are normalized. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 1aa33fe commit 8b3d4c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmake/modules/extensions.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,11 +2624,11 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES")
26242624
# `set(<var> CACHE)`, so let's update current scope variable to absolute
26252625
# path from `APPLICATION_SOURCE_DIR`.
26262626
if(NOT IS_ABSOLUTE ${path})
2627-
set(abs_path ${APPLICATION_SOURCE_DIR}/${path})
26282627
list(FIND ${ZFILE_APPLICATION_ROOT} ${path} index)
2628+
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY ${APPLICATION_SOURCE_DIR} NORMALIZE)
26292629
if(NOT ${index} LESS 0)
26302630
list(REMOVE_AT ${ZFILE_APPLICATION_ROOT} ${index})
2631-
list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${abs_path})
2631+
list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${path})
26322632
endif()
26332633
endif()
26342634
endforeach()
@@ -2645,6 +2645,7 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
26452645
endif()
26462646
endforeach()
26472647

2648+
list(REMOVE_DUPLICATES ZFILE_APPLICATION_ROOT)
26482649
# This updates the provided argument in parent scope (callers scope)
26492650
set(${ZFILE_APPLICATION_ROOT} ${${ZFILE_APPLICATION_ROOT}} PARENT_SCOPE)
26502651
endif()

0 commit comments

Comments
 (0)