summaryrefslogtreecommitdiffstats
path: root/cmake/QtToolHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-02-11 14:01:58 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-03-02 22:00:51 +0100
commitb1ad7f938e2f71288e65a8c9a86b732b89a6a345 (patch)
treedb0d239ee2795690bf2c53823c18346c06ac72bf /cmake/QtToolHelpers.cmake
parentf265c87e015c26225b80297f5c9f430ea7030214 (diff)
Generate information about user-facing applications in build dir
When packaging different Qt versions for Linux distributions (or any distribution with a common bin dir), Qt tools cannot be installed to /usr/bin, because the executable names of the different Qt versions clash. To solve this conflict, our recommendation is to install Qt's tools to /usr/lib/qt6/bin and to create versioned symlinks to user-facing tools in /usr/bin. User-facing tools are tools that are supposed to be started manually by the user. They are marked in Qt's build system. Distro package maintainers can now configure with -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_BINDIR=/usr/lib/qt6/bin -DINSTALL_PUBLICBINDIR=/usr/bin and will find a file called user_facing_tool_links.txt in the build directory after the cmake run. Nothing will be installed to INSTALL_PUBLICBINDIR. Each line of user_facing_tool_links.txt consists of the installation path of a user-facing application followed by a space and the versioned link name in INSTALL_PUBLICBINDIR. Example content: /usr/lib/qt6/bin/qmake /usr/bin/qmake6 To actually create the versioned symlinks, the content of this file can be fed to ln like this: xargs ln -s < build-dir/user_facing_tool_links.txt Or the package maintainer may decide to do something completely different as suits their needs. This patch adds the USER_FACING argument to qt_internal_add_tool to mark tools as user-facing. In addition, every Qt created by qt_internal_add_app is treated as user-facing. The only tool this patch marks as user-facing in qtbase is qmake. Pick-to: 6.1 Fixes: QTBUG-89170 Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'cmake/QtToolHelpers.cmake')
-rw-r--r--cmake/QtToolHelpers.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake
index 869a6e3300..e052479b6c 100644
--- a/cmake/QtToolHelpers.cmake
+++ b/cmake/QtToolHelpers.cmake
@@ -2,6 +2,9 @@
# The BOOTSTRAP option allows building it as standalone program, otherwise
# it will be linked against QtCore.
#
+# USER_FACING can be passed to mark the tool as a program that is supposed to be
+# started directly by users.
+#
# We must pass this function a target name obtained from
# qt_get_tool_target_name like this:
# qt_get_tool_target_name(target_name my_tool)
@@ -22,7 +25,7 @@ function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
set(one_value_keywords TOOLS_TARGET EXTRA_CMAKE_FILES INSTALL_DIR
${__default_target_info_args})
- qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_INSTALL"
+ qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_INSTALL;USER_FACING"
"${one_value_keywords}"
"${__default_private_args}" ${ARGN})
@@ -175,6 +178,10 @@ function(qt_internal_add_tool target_name)
)
endif()
+ if(arg_USER_FACING)
+ set_property(GLOBAL APPEND PROPERTY QT_USER_FACING_TOOL_TARGETS ${target_name})
+ endif()
+
# If building with a multi-config configuration, the main configuration tool will be placed in
# ./bin, while the rest will be in <CONFIG> specific subdirectories.
qt_get_tool_cmake_configuration(tool_cmake_configuration)