diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-08-16 10:42:48 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-09-15 12:55:23 +0200 |
commit | c9c04291f5f96ff885f7caae6c15ce9bc1377fcc (patch) | |
tree | bc2fc9d726915445181a2db48ec7089930b0b488 /tests/auto/cmake | |
parent | 6329fed0a8721a530d9dc485ecc5611a22db59d9 (diff) |
CMake: Add Linux support to qt_deploy_runtime_dependencies
Before this change, qt_deploy_runtime_dependencies supported Windows and
macOS only. We add a generic deployment method implemented in
cmake-language with file(GET_RUNTIME_DEPENDENCIES). This deployment
method is now enabled for shared builds on Linux.
The file(GRD) command requires that the EXECUTABLE argument points to
the executable in the build directory.
Only libraries in Qt's installation directory are considered for
deployment. This includes Qt's own libraries and also things like
libicu*.so we're shipping with the installer.
Unlike macdeployqt and windeployqt, the generic
qt_deploy_runtime_dependencies does not yet support deploying
translations. We will catch up on this in a later commit.
Change-Id: Iea23abcdba774d4c1885c8d2c243eb3e48fb7fae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/auto/cmake/test_widgets_app_deployment/CMakeLists.txt | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index eaf4fe67f0..5153350eb6 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -328,7 +328,8 @@ set(deploy_args # 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))) +if(WIN32 OR (APPLE AND NOT IOS) + OR (UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_CROSSCOMPILING)) _qt_internal_test_expect_pass(${deploy_args}) else() _qt_internal_test_expect_fail(${deploy_args}) diff --git a/tests/auto/cmake/test_widgets_app_deployment/CMakeLists.txt b/tests/auto/cmake/test_widgets_app_deployment/CMakeLists.txt index f1d59da234..60e3f0af75 100644 --- a/tests/auto/cmake/test_widgets_app_deployment/CMakeLists.txt +++ b/tests/auto/cmake/test_widgets_app_deployment/CMakeLists.txt @@ -12,7 +12,12 @@ qt6_standard_project_setup() function(create_test_executable target) cmake_parse_arguments(arg "" "" "" ${ARGN}) - qt_add_executable(${target} main.cpp) + if(CMAKE_VERSION VERSION_LESS "3.19") + qt_add_executable(${target} MANUAL_FINALIZATION main.cpp) + else() + qt_add_executable(${target} main.cpp) + endif() + set_target_properties(${target} PROPERTIES # We explicitly don't set WIN32_EXECUTABLE to ensure we see errors from stderr when # something fails and not having to use DebugView. @@ -34,10 +39,16 @@ function(create_test_executable target) ) install(SCRIPT ${deploy_script}) + if(CMAKE_VERSION VERSION_LESS "3.19") + qt_finalize_target(${target}) + endif() + if(APPLE AND NOT IOS) set(installed_app_location "${CMAKE_INSTALL_PREFIX}/${target}.app/Contents/MacOS/${target}") elseif(WIN32) set(installed_app_location "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${target}.exe") + elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_CROSSCOMPILING) + set(installed_app_location "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${target}") endif() # There's no nice way to get the location of an installed binary, so we need to construct |