From 8b3d4c6f0d71cfd66e39fa190aa396473d43bdc0 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 28 May 2024 09:56:17 +0200 Subject: [PATCH] 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 --- cmake/modules/extensions.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index d8ea799016a..de2aab58b1a 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2624,11 +2624,11 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES") # `set( CACHE)`, so let's update current scope variable to absolute # path from `APPLICATION_SOURCE_DIR`. if(NOT IS_ABSOLUTE ${path}) - set(abs_path ${APPLICATION_SOURCE_DIR}/${path}) list(FIND ${ZFILE_APPLICATION_ROOT} ${path} index) + cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY ${APPLICATION_SOURCE_DIR} NORMALIZE) if(NOT ${index} LESS 0) list(REMOVE_AT ${ZFILE_APPLICATION_ROOT} ${index}) - list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${abs_path}) + list(INSERT ${ZFILE_APPLICATION_ROOT} ${index} ${path}) endif() endif() endforeach() @@ -2645,6 +2645,7 @@ Relative paths are only allowed with `-D${ARGV1}=`") endif() endforeach() + list(REMOVE_DUPLICATES ZFILE_APPLICATION_ROOT) # This updates the provided argument in parent scope (callers scope) set(${ZFILE_APPLICATION_ROOT} ${${ZFILE_APPLICATION_ROOT}} PARENT_SCOPE) endif()