diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index c50ae70ebbb..434942cf2af 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1194,6 +1194,20 @@ function(_qt_internal_set_xcode_bundle_display_name target) set(QT_INTERNAL_DOLLAR_VAR "$" CACHE STRING "") endfunction() +# Adds ${PRODUCT_NAME} to the Info.plist file, which is then evaluated by Xcode itself. +function(_qt_internal_set_xcode_bundle_name target) + if(QT_NO_SET_XCODE_BUNDLE_NAME) + return() + endif() + + get_target_property(existing_bundle_name "${target}" MACOSX_BUNDLE_BUNDLE_NAME) + if(NOT MACOSX_BUNDLE_BUNDLE_NAME AND NOT existing_bundle_name) + set_target_properties("${target}" + PROPERTIES + MACOSX_BUNDLE_BUNDLE_NAME "\${PRODUCT_NAME}") + endif() +endfunction() + function(_qt_internal_generate_ios_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) @@ -1282,6 +1296,7 @@ function(_qt_internal_finalize_apple_app target) _qt_internal_set_xcode_development_team_id("${target}") _qt_internal_set_xcode_bundle_identifier("${target}") _qt_internal_set_xcode_code_sign_style("${target}") + _qt_internal_set_xcode_bundle_name("${target}") _qt_internal_set_xcode_bundle_display_name("${target}") _qt_internal_set_xcode_install_path("${target}") _qt_internal_set_placeholder_apple_bundle_version("${target}")