diff options
Diffstat (limited to 'Tests/RunCMake/GoogleTest')
5 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index b41df47e6d..8efd1171de 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -3,7 +3,10 @@ include(GoogleTest) enable_testing() +include(xcode_sign_adhoc.cmake) + add_executable(fake_gtest fake_gtest.cpp) +xcode_sign_adhoc(fake_gtest) gtest_discover_tests( fake_gtest @@ -22,6 +25,7 @@ gtest_discover_tests( ) add_executable(no_tests_defined no_tests_defined.cpp) +xcode_sign_adhoc(no_tests_defined) gtest_discover_tests( no_tests_defined @@ -33,6 +37,7 @@ gtest_discover_tests( # 3.10.3 and later behavior, old behavior added in 3.10.1 # is not supported. add_executable(property_timeout_test timeout_test.cpp) +xcode_sign_adhoc(property_timeout_test) target_compile_definitions(property_timeout_test PRIVATE sleepSec=10) gtest_discover_tests( @@ -50,6 +55,7 @@ gtest_discover_tests( ) add_executable(skip_test skip_test.cpp) +xcode_sign_adhoc(skip_test) gtest_discover_tests( skip_test diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake index e50648c718..2fae1e2332 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake @@ -3,7 +3,10 @@ include(GoogleTest) enable_testing() +include(xcode_sign_adhoc.cmake) + add_executable(configuration_gtest configuration_gtest.cpp) +xcode_sign_adhoc(configuration_gtest) target_compile_definitions(configuration_gtest PRIVATE $<$<CONFIG:Debug>:DEBUG=1>) gtest_discover_tests( diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake index cc614de44f..5c24d41186 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake @@ -3,7 +3,10 @@ include(GoogleTest) enable_testing() +include(xcode_sign_adhoc.cmake) + add_executable(discovery_timeout_test timeout_test.cpp) +xcode_sign_adhoc(discovery_timeout_test) target_compile_definitions(discovery_timeout_test PRIVATE discoverySleepSec=10) gtest_discover_tests( discovery_timeout_test diff --git a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake index 74b2c3f8fb..53eedc0414 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake @@ -3,6 +3,8 @@ include(GoogleTest) enable_testing() +include(xcode_sign_adhoc.cmake) + # This creates the folder structure for the paramterized tests # to avoid handling missing folders in C++ # @@ -15,6 +17,7 @@ enable_testing() file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/GoogleTestXMLSpecial/cases.case") add_executable(xml_output xml_output.cpp) +xcode_sign_adhoc(xml_output) gtest_discover_tests( xml_output XML_OUTPUT_DIR ${CMAKE_BINARY_DIR} diff --git a/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake new file mode 100644 index 0000000000..d2dc5305bb --- /dev/null +++ b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake @@ -0,0 +1,8 @@ +function(xcode_sign_adhoc target) + if(CMAKE_GENERATOR STREQUAL "Xcode" AND + "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing. + # See CMake Issue 21845. + target_link_options(${target} PRIVATE LINKER:-adhoc_codesign) + endif() +endfunction() |