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()