Skip to content

Commit

Permalink
cmake: Override generator for iOS projects to Xcode in qt-cmake.in
Browse files Browse the repository at this point in the history
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ø <[email protected]>
  • Loading branch information
alcroito authored and torarnv committed Mar 18, 2024
1 parent 6ee5fcc commit 990b601
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
2 changes: 2 additions & 0 deletions bin/qt-cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@ "$@"
22 changes: 0 additions & 22 deletions bin/qt-cmake.ios.in

This file was deleted.

17 changes: 13 additions & 4 deletions cmake/QtWrapperScriptHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 990b601

Please sign in to comment.