Skip to content

Commit 06cfbf0

Browse files
tejlmandanangl
authored andcommitted
[nrf fromtree] 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]> (cherry picked from commit 8b3d4c6)
1 parent 10c0de0 commit 06cfbf0

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
@@ -2609,11 +2609,11 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES")
26092609
# `set(<var> CACHE)`, so let's update current scope variable to absolute
26102610
# path from `APPLICATION_SOURCE_DIR`.
26112611
if(NOT IS_ABSOLUTE ${path})
2612-
set(abs_path ${APPLICATION_SOURCE_DIR}/${path})
26132612
list(FIND ${ZFILE_APPLICATION_ROOT} ${path} index)
2613+
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY ${APPLICATION_SOURCE_DIR} NORMALIZE)
26142614
if(NOT ${index} LESS 0)
26152615
list(REMOVE_AT ${ZFILE_APPLICATION_ROOT} ${index})
2616-
list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${abs_path})
2616+
list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${path})
26172617
endif()
26182618
endif()
26192619
endforeach()
@@ -2630,6 +2630,7 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
26302630
endif()
26312631
endforeach()
26322632

2633+
list(REMOVE_DUPLICATES ZFILE_APPLICATION_ROOT)
26332634
# This updates the provided argument in parent scope (callers scope)
26342635
set(${ZFILE_APPLICATION_ROOT} ${${ZFILE_APPLICATION_ROOT}} PARENT_SCOPE)
26352636
endif()

0 commit comments

Comments
 (0)