diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 6a885fc4ce2..293eca95a32 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 2e498284724..ba287447130 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 b60ef5e4480..11cfffc3ad1 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 similarity index 100% rename from cmake/macos/MacOSXBundleInfo.plist.in rename to cmake/macos/Info.plist.app.in