diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-05-11 13:15:20 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-05-20 13:06:06 +0200 |
commit | 55eb94cdbdf1b1fbd6424aa06921bc79123f88cd (patch) | |
tree | 5a0c959030c94444ceaf08af2ac6c7d8dcc30045 | |
parent | c0188b2dbd7e34b359b091865f19b87bc12d7bd5 (diff) |
CMake: Use the PRODUCT_NAME for the iOS display name like qmake
This ensures that the Xcode 'Display name' input under
${target} -> General -> Identity -> Display name is not empty.
Because adding ${PRODUCT_NAME} directly in the Info.plist.in template
will cause CMake to evaluate it as variable expansion, work around the
issue by putting the dollar sign into a separate cache variable that
after evaluation will result in ${PRODUCT_NAME} being in the file
verbatim, so that Xcode evaluate it at build time.
Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e
Pick-to: 6.2 6.3
Task-number: QTBUG-95838
Change-Id: I2d1090cc8e84b32442f7daca2d4ce5e3ad413c68
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r-- | cmake/ios/MacOSXBundleInfo.plist.in | 7 | ||||
-rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/cmake/ios/MacOSXBundleInfo.plist.in b/cmake/ios/MacOSXBundleInfo.plist.in index 5b15af1302..0cecf4ba99 100644 --- a/cmake/ios/MacOSXBundleInfo.plist.in +++ b/cmake/ios/MacOSXBundleInfo.plist.in @@ -4,18 +4,25 @@ <dict> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> + <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleName</key> <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string> + + <key>CFBundleDisplayName</key> + <string>${QT_INTERNAL_DOLLAR_VAR}{PRODUCT_NAME}</string> + <key>CFBundleIdentifier</key> <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string> + <key>CFBundleExecutable</key> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> <key>CFBundleVersion</key> <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string> + <key>CFBundleShortVersionString</key> <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 0070434945..718c8d683d 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1036,12 +1036,23 @@ function(_qt_internal_set_xcode_code_sign_style target) endif() endfunction() +function(_qt_internal_set_xcode_bundle_display_name target) + # We want the value of CFBundleDisplayName to be ${PRODUCT_NAME}, but we can't put that + # into the Info.plist.in template file directly, because the implicit configure_file(Info.plist) + # done by CMake is not using the @ONLY option, so CMake would treat the assignment as + # variable expansion. Escaping using backslashes does not help. + # Work around it by assigning the dollar char to a separate cache var, and expand it, so that + # the final value in the file will be ${PRODUCT_NAME}, to be evaluated at build time by Xcode. + set(QT_INTERNAL_DOLLAR_VAR "$" CACHE STRING "") +endfunction() + function(_qt_internal_finalize_ios_app target) _qt_internal_set_xcode_development_team_id("${target}") _qt_internal_set_xcode_bundle_identifier("${target}") _qt_internal_set_xcode_product_bundle_identifier("${target}") _qt_internal_set_xcode_targeted_device_family("${target}") _qt_internal_set_xcode_code_sign_style("${target}") + _qt_internal_set_xcode_bundle_display_name("${target}") _qt_internal_handle_ios_launch_screen("${target}") _qt_internal_set_placeholder_apple_bundle_version("${target}") |