CMake: Fix install location of dSYM bundle for Qt apps

Previously we used the TARGET_FILE genex as the destination where
to place the extracted dSYM bundle of an app in the build folder. For
Qt apps that have the MACOSX_BUNDLE property set, this is incorrect,
because it placed the dSYM bundle inside the app bundle.

We then manually install the dSYM bundle to the correct location.

Because the build folder app bundle still contains the dSYM
bundle, and CMake copies the entire app bundle dir when installing the
app, this resulted in installing the dSYM bundle twice.

Aside from waste of space, this is also against the Apple guidelines,
and leads to certain issues with code-signing.

Check the MACOSX_BUNDLE property to determine if the executable is a
bundle, in which case treat it the same way we treat framework
bundles, by placing the dSYM bundle next to the app bundle.

Pick-to: 6.8
Change-Id: I7fb8fe49e0b26d0df8a32fc82530bbee32b51382
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Alexandru Croitor 2024-11-14 15:29:47 +01:00
parent aa06c8dbfa
commit a60d42d873

View File

@ -286,9 +286,11 @@ function(qt_enable_separate_debug_info target installDestination)
set(BUNDLE_ID ${target}) set(BUNDLE_ID ${target})
endif() endif()
get_target_property(is_bundle ${target} MACOSX_BUNDLE)
if (NOT "x${arg_DSYM_OUTPUT_DIR}" STREQUAL "x") if (NOT "x${arg_DSYM_OUTPUT_DIR}" STREQUAL "x")
set(debug_info_bundle_dir "${arg_DSYM_OUTPUT_DIR}/${target}") set(debug_info_bundle_dir "${arg_DSYM_OUTPUT_DIR}/${target}")
elseif(is_framework) elseif(is_framework OR is_bundle)
set(debug_info_bundle_dir "$<TARGET_BUNDLE_DIR:${target}>") set(debug_info_bundle_dir "$<TARGET_BUNDLE_DIR:${target}>")
else() else()
set(debug_info_bundle_dir "$<TARGET_FILE:${target}>") set(debug_info_bundle_dir "$<TARGET_FILE:${target}>")