cmake: Override generator for iOS projects to Xcode in qt-cmake.in
Instead of maintaining a separate qt-cmake.ios.in wrapper script that can easily diverge from qt-cmake.in Change-Id: I53f4eac02188be89a4c11b3e71cde04ac2a24b51 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
6ee5fcc456
commit
990b60120e
@ -13,5 +13,7 @@ fi
|
||||
|
||||
toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake"
|
||||
|
||||
@extra_qt_cmake_code@
|
||||
|
||||
# Find the qt toolchain relative to the absolute bin dir path where the script is located.
|
||||
exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" @__qt_cmake_extra@ "$@"
|
||||
|
@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory.
|
||||
script_dir_path=`dirname $0`
|
||||
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
|
||||
|
||||
# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH.
|
||||
original_cmake_path="@CMAKE_COMMAND@"
|
||||
cmake_path=$original_cmake_path
|
||||
if ! test -f "$cmake_path"; then
|
||||
cmake_path="cmake"
|
||||
fi
|
||||
|
||||
# Find the qt toolchain relative to the absolute bin dir path where the script is located.
|
||||
toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake"
|
||||
|
||||
# Specify Xcode as the default generator by assigning it to the CMAKE_GENERATOR env var.
|
||||
# An explicit -G or -D CMAKE_GENERATOR given on the command line will still take precedence.
|
||||
export CMAKE_GENERATOR=Xcode
|
||||
|
||||
# Run cmake.
|
||||
exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" @__qt_cmake_extra@ "$@"
|
@ -19,13 +19,18 @@ function(qt_internal_create_wrapper_scripts)
|
||||
set(generate_non_unix TRUE)
|
||||
endif()
|
||||
|
||||
set(extra_qt_cmake_code "")
|
||||
if(generate_unix)
|
||||
|
||||
if(IOS)
|
||||
set(infix ".ios")
|
||||
else()
|
||||
set(infix "")
|
||||
set(extra_qt_cmake_code [=[
|
||||
# Specify Xcode as the default generator by assigning it to the CMAKE_GENERATOR env var.
|
||||
# An explicit -G or -D CMAKE_GENERATOR given on the command line will still take precedence.
|
||||
export CMAKE_GENERATOR=Xcode
|
||||
]=])
|
||||
endif()
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake${infix}.in"
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in"
|
||||
"${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake" @ONLY
|
||||
NEWLINE_STYLE LF)
|
||||
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake"
|
||||
@ -53,6 +58,10 @@ function(qt_internal_create_wrapper_scripts)
|
||||
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-create.bat"
|
||||
DESTINATION "${INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
# Reset the contents for the next script.
|
||||
set(extra_qt_cmake_code "")
|
||||
|
||||
# Provide a private convenience wrapper with options that should not be propagated via the
|
||||
# public qt-cmake wrapper e.g. CMAKE_GENERATOR.
|
||||
# These options can not be set in a toolchain file, but only on the command line.
|
||||
|
Loading…
x
Reference in New Issue
Block a user