summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-02-02 12:07:43 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-02-02 17:53:56 +0100
commitcec2e42052a04cd2481c20bd4be5de2ba5ccaec2 (patch)
tree920d3a57b7395985597d6aa7ac7fb21e40da2a88 /cmake
parent60889fcf72da0c3bf003ea587befee6b573ccb23 (diff)
CMake: Fix configuring a standalone test on Apple platforms
Configuring a test as standalone would fail with the following error: Invalid max SDK version: It should be a major version number, without minor This happened because _qt_internal_check_apple_sdk_and_xcode_versions expects QT_SUPPORTED_MAX_MACOS_SDK_VERSION to be available, but it is not yet set due to Qt6 package not being found yet. Avoid the issue by exporting the version requirements into both Qt6ConfigExtras.cmake and Qt6BuildInternalsConfigExtra.cmake. Make sure to assign the variables only once. Amends a29bff3d80219f54d0837b0e6e0577192011dea1 Amends a0bdd2195f24d8a7d880ba506afc16b41337218e Pick-to: 6.6 6.7 Task-number: QTBUG-119490 Change-Id: Ic297eeaabf22c8c42ded1a766906f88fdb91fd3d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPostProcessHelpers.cmake13
-rw-r--r--cmake/QtPublicAppleHelpers.cmake6
2 files changed, 18 insertions, 1 deletions
diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake
index c690ff521f..dfcbefd4f8 100644
--- a/cmake/QtPostProcessHelpers.cmake
+++ b/cmake/QtPostProcessHelpers.cmake
@@ -720,6 +720,19 @@ set(QT_COPYRIGHT_YEAR \"${QT_COPYRIGHT_YEAR}\" CACHE STRING \"\")
set(QT_COPYRIGHT \"${QT_COPYRIGHT}\" CACHE STRING \"\")
")
+ # Add the apple version requirements to the BuildInternals extra code, so the info is
+ # available when configuring a standalone test.
+ # Otherwise when QtSetup is included after a
+ # find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+ # call, Qt6ConfigExtras.cmake is not included yet, the requirements are not available and
+ # _qt_internal_check_apple_sdk_and_xcode_versions() would fail.
+ _qt_internal_export_apple_sdk_and_xcode_version_requirements(apple_requirements)
+ if(apple_requirements)
+ string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "
+${apple_requirements}
+")
+ endif()
+
qt_compute_relative_path_from_cmake_config_dir_to_prefix()
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/QtBuildInternalsExtra.cmake.in"
diff --git a/cmake/QtPublicAppleHelpers.cmake b/cmake/QtPublicAppleHelpers.cmake
index 7727bb3f16..09e189fb38 100644
--- a/cmake/QtPublicAppleHelpers.cmake
+++ b/cmake/QtPublicAppleHelpers.cmake
@@ -692,7 +692,11 @@ function(_qt_internal_export_apple_sdk_and_xcode_version_requirements out_var)
set(assignments "")
foreach(var IN LISTS vars_to_assign)
set(value "${${var}}")
- list(APPEND assignments "set(${var} \"${value}\")")
+ list(APPEND assignments
+ "
+if(NOT ${var})
+ set(${var} \"${value}\")
+endif()")
endforeach()
list(JOIN assignments "\n" assignments)