diff --git a/REUSE.toml b/REUSE.toml index 6cdfd9b8a95..a5b304ecade 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -24,7 +24,7 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" path = ["bin/*", "coin/**","libexec/*","**_clang-format", "**.cmake", "**.conf", "**.cmake.in", "**.prf", "libexec/qt-internal-configure-*", "config.tests/.qmake.conf", "**.pro", "**.pri", "**.yaml", "cmake/**.in", "cmake/ios/LaunchScreen.storyboard", - "cmake/**md", "**.yml", "**.dynlist", + "cmake/**md", "**.yml", "**.dynlist", "cmake/**.plist", "src/corelib/global/qconfig.cpp.in", "src/corelib/Qt6CoreConfigureFileTemplate.in", "**.cfg"] precedence = "closest" diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index dc14a6110cd..1e028c4a72c 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -366,7 +366,15 @@ if(APPLE) DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}" ) - if(IOS) + if(MACOS) + # Test entitlements + qt_copy_or_install(FILES "cmake/${platform_shortname}/test.entitlements.plist" + DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}" + ) + file(COPY "cmake/${platform_shortname}/test.entitlements.plist" + DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}" + ) + elseif(IOS) qt_copy_or_install(FILES "cmake/ios/LaunchScreen.storyboard" DESTINATION "${__GlobalConfig_install_dir}/ios" ) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 94cd99cd6df..c110409be7d 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -902,6 +902,20 @@ function(qt_internal_add_test name) endif() endif() + if(MACOS AND NOT CMAKE_GENERATOR STREQUAL "Xcode") + # Add com.apple.security.get-task-allow entitlement to each + # test binary, so we can hook into the Swift crash handling. + if(NOT arg_QMLTEST AND arg_SOURCES) + set(entitlements_file + "${__qt_internal_cmake_apple_support_files_path}/test.entitlements.plist") + add_custom_command(TARGET "${name}" + POST_BUILD COMMAND codesign --sign - + --entitlements "${entitlements_file}" + "$" + ) + endif() + endif() + qt_internal_add_test_finalizers("${name}") endfunction() diff --git a/cmake/macos/test.entitlements.plist b/cmake/macos/test.entitlements.plist new file mode 100644 index 00000000000..a8b9fdfb8c1 --- /dev/null +++ b/cmake/macos/test.entitlements.plist @@ -0,0 +1,9 @@ + + + + + com.apple.security.get-task-allow + + +