summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-04-20 12:13:09 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-06-01 14:07:18 +0200
commit2f273f5dfd95c711b2be1458582596f3ca61a436 (patch)
treeb0e196a18dc04393b9b3990bd7b335c9369c2244 /cmake
parentd6ed400037928f92ab6aae1e63e0eae9979621eb (diff)
cmake: Copy template Info.plist for macOS manually, like we do for iOS
Unifies the approach between iOS and macOS. By copying the Info.plist to the build directory, we also open up the possibility to modify it, which we can't do when CMake does the copy during its generator step. Change-Id: I59f9f69ac368166bb26d8a5c57bf4ea3f503d51b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBaseGlobalTargets.cmake31
-rw-r--r--cmake/QtConfig.cmake.in13
-rw-r--r--cmake/QtPublicAppleHelpers.cmake14
-rw-r--r--cmake/macos/Info.plist.app.in (renamed from cmake/macos/MacOSXBundleInfo.plist.in)0
4 files changed, 36 insertions, 22 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index 6a885fc4ce..293eca95a3 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -387,17 +387,30 @@ if(QT_WILL_INSTALL)
)
endif()
-if(MACOS)
- qt_copy_or_install(FILES
- cmake/macos/MacOSXBundleInfo.plist.in
- DESTINATION "${__GlobalConfig_install_dir}/macos"
+if(APPLE)
+ if(MACOS)
+ set(platform_shortname "macos")
+ elseif(IOS)
+ set(platform_shortname "ios")
+ endif()
+
+ qt_copy_or_install(FILES "cmake/${platform_shortname}/Info.plist.app.in"
+ DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}"
)
-elseif(IOS)
- qt_copy_or_install(FILES
- cmake/ios/Info.plist.app.in
- cmake/ios/LaunchScreen.storyboard
- DESTINATION "${__GlobalConfig_install_dir}/ios"
+ # For examples built as part of prefix build before install
+ file(COPY "cmake/${platform_shortname}/Info.plist.app.in"
+ DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}"
)
+
+ if(IOS)
+ qt_copy_or_install(FILES "cmake/ios/LaunchScreen.storyboard"
+ DESTINATION "${__GlobalConfig_install_dir}/ios"
+ )
+ # For examples built as part of prefix build before install
+ file(COPY "cmake/ios/LaunchScreen.storyboard"
+ DESTINATION "${__GlobalConfig_build_dir}/ios"
+ )
+ endif()
elseif(WASM)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/wasmtestrunner/qt-wasmtestrunner.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py" @ONLY)
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in
index 2e49828472..ba28744713 100644
--- a/cmake/QtConfig.cmake.in
+++ b/cmake/QtConfig.cmake.in
@@ -29,13 +29,12 @@ list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}")
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/extra-cmake-modules/find-modules")
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/kwin")
-if(APPLE AND (NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
- # Add module directory to pick up custom Info.plist template for macOS
- list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/macos")
-elseif(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
- # Add module directory to pick up custom Info.plist template for iOS
- set(__qt_internal_cmake_ios_support_files_path "${_qt_import_prefix}/ios")
- list(APPEND CMAKE_MODULE_PATH "${__qt_internal_cmake_ios_support_files_path}")
+if(APPLE)
+ if(NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(__qt_internal_cmake_apple_support_files_path "${_qt_import_prefix}/macos")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ set(__qt_internal_cmake_apple_support_files_path "${_qt_import_prefix}/ios")
+ endif()
endif()
# Public helpers available to all Qt packages.
diff --git a/cmake/QtPublicAppleHelpers.cmake b/cmake/QtPublicAppleHelpers.cmake
index b60ef5e448..11cfffc3ad 100644
--- a/cmake/QtPublicAppleHelpers.cmake
+++ b/cmake/QtPublicAppleHelpers.cmake
@@ -27,7 +27,7 @@ function(_qt_internal_handle_ios_launch_screen target)
if(NOT launch_screen AND NOT QT_NO_SET_DEFAULT_IOS_LAUNCH_SCREEN)
set(is_default_launch_screen TRUE)
set(launch_screen
- "${__qt_internal_cmake_ios_support_files_path}/LaunchScreen.storyboard")
+ "${__qt_internal_cmake_apple_support_files_path}/LaunchScreen.storyboard")
endif()
# Check that the launch screen exists.
@@ -531,14 +531,14 @@ function(_qt_internal_set_xcode_bitcode_enablement target)
"NO")
endfunction()
-function(_qt_internal_generate_ios_info_plist target)
+function(_qt_internal_generate_info_plist target)
# If the project already specifies a custom file, we don't override it.
get_target_property(existing_plist "${target}" MACOSX_BUNDLE_INFO_PLIST)
if(existing_plist)
return()
endif()
- set(info_plist_in "${__qt_internal_cmake_ios_support_files_path}/Info.plist.app.in")
+ set(info_plist_in "${__qt_internal_cmake_apple_support_files_path}/Info.plist.app.in")
string(MAKE_C_IDENTIFIER "${target}" target_identifier)
set(info_plist_out_dir
@@ -598,6 +598,8 @@ endfunction()
function(_qt_internal_finalize_apple_app target)
# Shared between macOS and iOS apps
+ _qt_internal_generate_info_plist("${target}")
+
# Only set the various properties if targeting the Xcode generator, otherwise the various
# Xcode tokens are embedded as-is instead of being dynamically evaluated.
# This affects things like the version number or application name as reported by Qt API.
@@ -613,12 +615,12 @@ function(_qt_internal_finalize_apple_app target)
endfunction()
function(_qt_internal_finalize_ios_app target)
- _qt_internal_finalize_apple_app("${target}")
+ # Must be called before we generate the Info.plist
+ _qt_internal_handle_ios_launch_screen("${target}")
+ _qt_internal_finalize_apple_app("${target}")
_qt_internal_set_xcode_targeted_device_family("${target}")
_qt_internal_set_xcode_bitcode_enablement("${target}")
- _qt_internal_handle_ios_launch_screen("${target}")
- _qt_internal_generate_ios_info_plist("${target}")
_qt_internal_set_ios_simulator_arch("${target}")
endfunction()
diff --git a/cmake/macos/MacOSXBundleInfo.plist.in b/cmake/macos/Info.plist.app.in
index c791521655..c791521655 100644
--- a/cmake/macos/MacOSXBundleInfo.plist.in
+++ b/cmake/macos/Info.plist.app.in