summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-05-06 13:38:05 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-06-09 10:40:20 +0200
commit9d5c935cff4e02f2d77dbf650243cc5b392fb9ea (patch)
tree688bb9c66691ac434663b4748478cf2427f8e0d4 /cmake
parentfb00dabee2dd0f26ed3cec87bd2f1e6fa2e70ea5 (diff)
CMake: Automatically use Xcode generator in qt-cmake + iOS
When calling qt-cmake on the command line, we don't usually force usage of a particular CMake generator and defer to the user's choice or CMake's default for the host OS. In the case of iOS, the generator that makes the most sense to use is Xcode. One could also use Ninja / Unix Makefiles if the project is only building static libraries, but for shared libraries and executables the project likely needs the code signing provided by xcodebuild. When targeting iOS, use a different qt-cmake file template. The iOS-specific shell script will set the CMAKE_GENERATOR environment variable to 'Xcode'. If no -G or -D CMAKE_GENERATOR is provided on the command line then the project will use the Xcode generator. Otherwise the generator given on the command line takes precedence. The CMAKE_GENERATOR environment variable from the parent process is completely ignored. The logic is only done for iOS, to reduce the likeliness of breaking the qt-cmake script for other platforms. Note that Qt Creator does not use qt-cmake, but rather calls cmake directly with additional options like the toolchain file, architecture, sysroot, etc. [ChangeLog][iOS][CMake] qt-cmake now defaults to using the Xcode generator when targeting iOS projects. Fixes: QTBUG-100834 Change-Id: I39b3dce47cc9ee2f98678631e4bd035c59c65294 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a3917126e821ca8f5f5d423a65344a2f9663250c) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtWrapperScriptHelpers.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmake/QtWrapperScriptHelpers.cmake b/cmake/QtWrapperScriptHelpers.cmake
index 1480ea3176..adb50bf25b 100644
--- a/cmake/QtWrapperScriptHelpers.cmake
+++ b/cmake/QtWrapperScriptHelpers.cmake
@@ -17,9 +17,14 @@ function(qt_internal_create_wrapper_scripts)
endif()
if(generate_unix)
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in"
+ if(IOS)
+ set(infix ".ios")
+ else()
+ set(infix "")
+ endif()
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake${infix}.in"
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake" @ONLY
- NEWLINE_STYLE LF)
+ NEWLINE_STYLE LF)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake"
DESTINATION "${INSTALL_BINDIR}")
endif()