summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/CMakeLists.txt
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2022-09-29 13:06:12 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2022-10-15 13:00:04 +0200
commit5430fb22439db9fc1ad1df4cbf0319b63346b0a5 (patch)
tree4c25135c0fb476dbb36bb2601d094d42b3e4b638 /tests/auto/cmake/CMakeLists.txt
parent5ca714318c4b0c02f3b9ef98c5fc1c948c35219e (diff)
CMake: Set RPATH of deployed plugins on Linux
When deploying into some directory structure where CMAKE_INSTALL_LIBDIR is different from Qt's lib dir, we need to set the RPATH of installed plugins such that Qt libraries are found. We do this using CMake's undocumented file(RPATH_SET) command and pray that this command is safe to use across current and future CMake versions. For CMake versions < 3.21, we use patchelf, which must be installed on the host system. The adjustment of rpaths can be turned on explicitly by setting QT_DEPLOY_FORCE_ADJUST_RPATHS to ON. The usage of patchelf can be forced by setting QT_DEPLOY_USE_PATCHELF to ON regardless of the CMake version. Change-Id: I62ced496b4c12bf6d46735d2af7ff35130148acb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/CMakeLists.txt15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index e841308fc8..afc6002ff6 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -46,6 +46,7 @@
cmake_minimum_required(VERSION 3.16)
project(cmake_usage_tests)
+include(GNUInstallDirs)
# Building the CMake tests as part of a Qt prefix build + in-tree tests, currently doesn't work.
# Each CMake test will fail with a message like
@@ -335,12 +336,16 @@ set(deploy_args
NO_RUN_ENVIRONMENT_PLUGIN_PATH
)
-# For now, the test should only pass on Windows and macOS shared and static builds and fail on
-# other platforms, because there is no support for runtime dependency deployment
-# on those platforms.
+set(is_desktop_linux FALSE)
+if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_CROSSCOMPILING)
+ set(is_desktop_linux TRUE)
+endif()
+
+# For now, the test should only pass on Windows, macOS and desktop Linux shared and static builds
+# and fail on other platforms, because there is no support for runtime dependency deployment on
+# those platforms.
# With static builds the runtime dependencies are just skipped, but the test should still pass.
-if(WIN32 OR (APPLE AND NOT IOS)
- OR (UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_CROSSCOMPILING))
+if(WIN32 OR (APPLE AND NOT IOS) OR is_desktop_linux)
_qt_internal_test_expect_pass(${deploy_args})
else()
_qt_internal_test_expect_fail(${deploy_args})