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 6.9
Change-Id: Ib82aa9fe6b5d32e374e8b1acf05402312b6dbe1a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2025-04-03 14:37:18 +02:00
parent 4422480260
commit a20f281212

View File

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