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 <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a20f28121264bfe18af13bfe14be7fd29d33a2fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2025-04-03 14:37:18 +02:00 committed by Qt Cherry-pick Bot
parent 0d2fd73c29
commit fe1863228c

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