summaryrefslogtreecommitdiffstats
path: root/cmake/QtToolchainHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-07 16:25:27 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-10 11:20:44 +0200
commit0d8eb8a5ab436452433eae69290fe35fe28cd532 (patch)
tree82202604909ce48c36b29db27dcef3754bfd2f6f /cmake/QtToolchainHelpers.cmake
parentb0e8c52fd4ad17e0964993f36578bff7810e20ff (diff)
CMake: Don't build cmake build tests as macOS universal
We want standalone tests added by qt_internal_add_test to be built as universal executables, so we can build them on an intel machine and run them on an ARM machine. But CMake build tests will be built on the final machine that runs the tests and it might lack a universal SDK. That's why they should be built only targeting the architecture of the machine they're running on. Change the generated qt.tooclhain.cmake file to allow opting in or out of building projects with the same architectures as Qt was configured with. Now standalone tests will be multi-arch, but CMake build tests will be single-arch. Amends e379147f9571af8c3af5768b9040e0180819a855 Task-number: QTBUG-85447 Task-number: QTBUG-87580 Task-number: QTBUG-92933 Change-Id: I41ab047983115f84eb2333cc9ac2d19ca08d621f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtToolchainHelpers.cmake')
-rw-r--r--cmake/QtToolchainHelpers.cmake10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake
index 2f4c23eb1e..3d9de3ecdd 100644
--- a/cmake/QtToolchainHelpers.cmake
+++ b/cmake/QtToolchainHelpers.cmake
@@ -130,11 +130,13 @@ function(qt_internal_create_toolchain_file)
# When building another qt repo, ensure the same list of architectures is used by default.
# Detection of a qt repo is done by checking for QT_REPO_MODULE_VERSION which is set in
# the repo's .cmake.conf file.
- # Standalone tests will be not be built with multiple architectures to avoid issues in the
- # CI when trying to run cmake build tests on VMs that do not have a universal macOS
+ # Most standalone tests will also be built with multiple architectures.
+ # Certain tests will be built with a single arch only (like tests/auto/cmake) to avoid
+ # issues in the CI when trying to build them on VMs that do not have a universal macOS
# SDK.
- list(APPEND init_platform "# Only build multiple architectures when building Qt itself")
- list(APPEND init_platform "if((QT_REPO_MODULE_VERSION AND NOT QT_BUILD_STANDALONE_TESTS) OR QT_FORCE_QT_OSX_ARCHITECTURES)")
+ list(APPEND init_platform
+ "# Only build multiple architectures when building Qt itself. Can be explicitly enabled or disabled.")
+ list(APPEND init_platform "if((QT_REPO_MODULE_VERSION AND NOT QT_FORCE_SINGLE_QT_OSX_ARCHITECTURE) OR QT_FORCE_ALL_QT_OSX_ARCHITECTURES)")
list(APPEND init_platform " set(__qt_toolchain_building_qt_repo TRUE)")
list(APPEND init_platform " set(CMAKE_OSX_ARCHITECTURES \"\${QT_OSX_ARCHITECTURES}\" CACHE STRING \"\")")
list(APPEND init_platform "endif()")