summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-02-14 16:38:47 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-03-16 15:56:17 +0100
commit21bffeec9031bc1b5e1cb518508650fe4ad04225 (patch)
tree8fd0ba14b1bd601f9ed19b0eaa7edf9f7d897776 /tests/auto/cmake/CMakeLists.txt
parentd1c56073b4cf3346168413e7d931c63355307e9d (diff)
CMake: Add deployment auto test
Add a cmake test that builds a simple widgets application, installs it, in a shared Qt build deploys the runtime dependencies and then runs it to confirm that the app works. With a static Qt, the installation of the runtime dependencies is skipped, but the app should still run. The test is expected to pass only when targeting Windows and macOS (both when using shared and static Qt). Pick-to: 6.3 Task-number: QTBUG-98545 Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/cmake/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 8073a47c16..54ce69f0be 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -284,3 +284,22 @@ _qt_internal_test_expect_pass(test_static_resources
_qt_internal_test_expect_pass(test_generating_cpp_exports)
_qt_internal_test_expect_pass(test_qt_extract_metatypes)
+
+set(deploy_args
+ test_widgets_app_deployment
+ BINARY "${CMAKE_CTEST_COMMAND}"
+ BINARY_ARGS "-V"
+ # Need to explicitly specify a writable install prefix.
+ BUILD_OPTIONS
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_widgets_app_deployment_installed
+)
+
+# 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.
+# With static builds the runtime dependencies are just skipped, but the test should still pass.
+if((WIN32 OR (APPLE AND NOT IOS)))
+ _qt_internal_test_expect_pass(${deploy_args})
+else()
+ _qt_internal_test_expect_fail(${deploy_args})
+endif()