From fe1863228c000ea94aecccb69344bb4bd71717f8 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Apr 2025 14:37:18 +0200 Subject: [PATCH] CMake: Fix CMP0177 warnings by adjusting qt_join_path INSTALL_DATADIR and INSTALL_ARCHDATADIR have the value "." by default. CMP0177 in CMake 3.31 now warns when paths that have "." as a component are passed to install(). To avoid the warning, change the implementation of qt_path_join, to filter out "." components. That way all install() calls that build up their paths via qt_path_join() will avoid the warning. Pick-to: 6.8 Change-Id: Ib82aa9fe6b5d32e374e8b1acf05402312b6dbe1a Reviewed-by: Alexey Edelev Reviewed-by: Joerg Bornemann (cherry picked from commit a20f28121264bfe18af13bfe14be7fd29d33a2fe) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtPublicCMakeHelpers.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake index c06271b8cdf..8aca7018ca0 100644 --- a/cmake/QtPublicCMakeHelpers.cmake +++ b/cmake/QtPublicCMakeHelpers.cmake @@ -536,8 +536,14 @@ endfunction() # Takes a list of path components and joins them into one path separated by forward slashes "/", # and saves the path in out_var. +# Filters out any path parts that are bare "."s. function(_qt_internal_path_join out_var) - string(JOIN "/" path ${ARGN}) + set(args ${ARGN}) + + # Remove any bare ".", to avoid any CMP0177 warnings for paths passed to install(). + list(REMOVE_ITEM args ".") + + string(JOIN "/" path ${args}) set(${out_var} ${path} PARENT_SCOPE) endfunction()