mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-30 19:29:18 -06:00
We run test executables to discover tests. Use the same launchers that are used to run the tests. We already handle `CROSSCOMPILING_EMULATOR`. Update the logic to account for the `TEST_LAUNCHER` property added by commit1ec0372ed4(add_test: Optionally use a launcher for tests running in-project targets, 2023-11-11), and for the `CROSSCOMPILING_EMULATOR` behavior change in commitca5a300d7f(add_test: Honor CROSSCOMPILING_EMULATOR only when cross-compiling, 2023-11-02). Fixes: #25603 Co-authored-by: Brad King <brad.king@kitware.com> Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
30 lines
673 B
CMake
30 lines
673 B
CMake
enable_language(C)
|
|
include(GoogleTest)
|
|
|
|
enable_testing()
|
|
|
|
include(xcode_sign_adhoc.cmake)
|
|
|
|
add_executable(test_launcher test_launcher.c)
|
|
|
|
add_executable(launcher_test launcher_test.c)
|
|
xcode_sign_adhoc(launcher_test)
|
|
set(launcher
|
|
"$<TARGET_FILE:test_launcher>"
|
|
"" # Verify that an empty list item will be preserved
|
|
"launcherparam"
|
|
"--"
|
|
)
|
|
set_property(TARGET launcher_test PROPERTY TEST_LAUNCHER "${launcher}")
|
|
set(emulator
|
|
"$<TARGET_FILE:test_launcher>"
|
|
"" # Verify that an empty list item will be preserved
|
|
"emulatorparam"
|
|
"--"
|
|
)
|
|
set_property(TARGET launcher_test PROPERTY CROSSCOMPILING_EMULATOR "${emulator}")
|
|
|
|
gtest_discover_tests(
|
|
launcher_test
|
|
)
|