diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-03-21 19:34:30 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-04-09 18:48:43 +0200 |
commit | 5898e0e4f14d1e6d0b0fc09e122346d817cb821a (patch) | |
tree | 1b1a187ef74de0bdc6f1a164c6842d6373924188 | |
parent | 738914e787c5a2de57f40753b665e2a49f9536d3 (diff) |
CMake: Improve Xcode projects for single SDK builds on Apple platforms
Xcode expects the base SDK to always be the device SDK, so we can't
pass CMAKE_OSX_SYSROOT on directly.
We use the Xcode SUPPORTED_PLATFORMS setting to inform Xcode about
which targets we can actually build and run for.
Change-Id: Ib46e81e946bc89f62d1e700422b37166c3d55009
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index f55e32a7cf..e8da0f3e63 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -3474,6 +3474,17 @@ macro(qt6_standard_project_setup) if(NOT DEFINED QT_I18N_SOURCE_LANGUAGE) set(QT_I18N_SOURCE_LANGUAGE ${__qt_sps_arg_I18N_SOURCE_LANGUAGE}) endif() + + # Ensure we always use device SDK for Xcode + if(CMAKE_GENERATOR STREQUAL "Xcode") + if(${CMAKE_OSX_SYSROOT} MATCHES "^[a-z]+simulator$") + # Xcode expects the base SDK to be the device SDK + set(simulator_sysroot "${CMAKE_OSX_SYSROOT}") + string(REGEX REPLACE "simulator" "os" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") + set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}" CACHE STRING "" FORCE) + set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "${simulator_sysroot}") + endif() + endif() endif() endmacro() |