summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-10-08 18:37:14 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-10-12 13:35:53 +0200
commit1e1805ed36a932dcb085a1ad3308782a136d477c (patch)
treeefc661966448dadafe4d39fb89de06ff2ea6ca30 /cmake
parent28ed9e3e2d8f3be46d0498e06b7d9664f32dcfb8 (diff)
CMake: Workaround iOS Xcode issue when configuring app
It appears that CMake's Xcode generator default behavior can't really handle imported object libraries location, which Qt uses extensively (all the qt_add_resource calls). Specifically the project fails to configure with the following error message: The OBJECT library type may not be used for IMPORTED libraries under Xcode with multiple architectures. An issue was filed upstream at https://gitlab.kitware.com/cmake/cmake/-/issues/21276 In the mean time, it looks like it's possible to work around the issue by setting XCODE_EMIT_EFFECTIVE_PLATFORM_NAME global property to OFF. This needs to be done before the very first project() call, so we do it in the generated Qt toolchain file. Note that the workaround only works if the CMake project is configured with a single architecture given to CMAKE_OSX_ARCHITECTURES. If multiple arches are given, it will fail with the same error message. Fixes: QTBUG-87198 Change-Id: I2556ae28b2fc2d9cfe464a5acf9c4fcbaf01b654 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBaseGlobalTargets.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index b317d191b9..3558d6bbe5 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -208,6 +208,10 @@ endif()")
list(APPEND init_platform
"set(CMAKE_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"\")")
unset(_qt_osx_architectures_escaped)
+
+ list(APPEND init_platform "if(CMAKE_GENERATOR STREQUAL \"Xcode\" AND NOT QT_NO_XCODE_EMIT_EPN)")
+ list(APPEND init_platform " set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME OFF)")
+ list(APPEND init_platform "endif()")
endif()
elseif(ANDROID)
list(APPEND init_platform "set(ANDROID_NATIVE_API_LEVEL \"${ANDROID_NATIVE_API_LEVEL}\" CACHE STRING \"\")")