summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-26 20:16:46 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-29 15:30:24 (GMT)
commit13ece67a58a4755807a2e9001e245fdafe9e52e2 (patch)
treef5d29e88f5d54106e84bd68ad84a85a1984f83fc /Tests
parentb9ad73fcb2ddbdd53eff6c3ba635b96f5ed0c87b (diff)
downloadCMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.zip
CMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.tar.gz
CMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.tar.bz2
Add genex support to TEST_LAUNCHER and CROSSCOMPILING_EMULATOR
Evaluate generator expressions in these properties, as they apply to `add_test`, `add_custom_command`, and `add_custom_target`. The `CMAKE_CROSSCOMPILING_EMULATOR` variable's `try_run` behavior occurs at configure time and so cannot support generator expressions.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake2
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake14
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake2
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake12
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake2
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake10
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake10
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake16
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt22
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake10
-rw-r--r--Tests/RunCMake/FileAPI/cxx/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/FileAPI/cxx/cross/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/add_test/TestLauncher-check.cmake14
-rw-r--r--Tests/RunCMake/add_test/TestLauncher-test-stdout.txt20
-rw-r--r--Tests/RunCMake/add_test/TestLauncher.cmake7
15 files changed, 110 insertions, 37 deletions
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
index 67fe8ec..45c66ea 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
@@ -1,4 +1,4 @@
-foreach(output IN ITEMS output1 output2 output3 output4)
+foreach(output IN ITEMS output1 output2 output3 output4 output5)
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/${output}")
set(RunCMake_TEST_FAILED "Failed to create output:\n ${RunCMake_TEST_BINARY_DIR}/${output}")
return()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
index 30cbbe3..58bf817 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
@@ -3,6 +3,8 @@ set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
+get_property(emulator TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR)
+set_property(TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
# Executable: Return error code equal to 0
add_executable(generated_exe_emulator_unexpected emulator_unexpected.c)
@@ -47,6 +49,17 @@ add_custom_command(OUTPUT output4
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4
DEPENDS generated_exe_emulator_expected)
+# Use locally-built emulator.
+add_executable(local_emulator ../pseudo_emulator.c)
+add_executable(use_emulator_local simple_src_exiterror.c)
+set_property(TARGET use_emulator_local PROPERTY CROSSCOMPILING_EMULATOR "$<TARGET_FILE:local_emulator>")
+add_dependencies(use_emulator_local local_emulator)
+add_custom_command(OUTPUT output5
+ COMMAND ${CMAKE_COMMAND} -E echo use_emulator_local
+ COMMAND use_emulator_local
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output5
+ DEPENDS use_emulator_local)
+
add_custom_target(ensure_build ALL
SOURCES
${CMAKE_CURRENT_BINARY_DIR}/output1
@@ -54,4 +67,5 @@ add_custom_target(ensure_build ALL
${CMAKE_CURRENT_BINARY_DIR}/output3
${CMAKE_CURRENT_BINARY_DIR}/outputImp
${CMAKE_CURRENT_BINARY_DIR}/output4
+ ${CMAKE_CURRENT_BINARY_DIR}/output5
)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
index be30dbc..c5efe03 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
@@ -3,6 +3,8 @@ set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
+get_property(emulator TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR)
+set_property(TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
add_custom_command(OUTPUT output
COMMAND generated_exe_emulator_expected
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
index 3682577..9d7c2b1 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
@@ -3,6 +3,8 @@ set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
+get_property(emulator TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR)
+set_property(TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
# Executable: Return error code equal to 0
add_executable(generated_exe_emulator_unexpected emulator_unexpected.c)
@@ -43,3 +45,13 @@ add_custom_target(generate_output4 ALL
generated_exe_emulator_expected
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4
DEPENDS generated_exe_emulator_expected)
+
+# Use locally-built emulator.
+add_executable(local_emulator ../pseudo_emulator.c)
+add_executable(use_emulator_local simple_src_exiterror.c)
+set_property(TARGET use_emulator_local PROPERTY CROSSCOMPILING_EMULATOR "$<TARGET_FILE:local_emulator>")
+add_dependencies(use_emulator_local local_emulator)
+add_custom_target(generate_output5 ALL
+ use_emulator_local
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output5
+ DEPENDS use_emulator_local)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
index e98c66f..c08d58d 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
@@ -3,6 +3,8 @@ set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
+get_property(emulator TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR)
+set_property(TARGET generated_exe_emulator_expected PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
add_custom_target(generate_output ALL
generated_exe_emulator_expected
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
index 6d5128a..e6da71f 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
@@ -8,27 +8,27 @@ endif()
set(error_details "There is a problem with generated test file:\n ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
index 079e45c..b92ed4e 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
@@ -8,27 +8,27 @@ endif()
set(error_details "There is a problem with generated test file:\n ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
index bd2c8bf..69c2332 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
@@ -8,32 +8,36 @@ endif()
set(error_details "There is a problem with generated test file:\n ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_emulator[^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^$<>\n]+pseudo_emulator[^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use test launcher and emulator when they should be used. ${error_details}")
return()
endif()
+
+if(NOT testfile_contents MATCHES "add_test[(]UsesLocalEmulator [^$<>\n]+local_emulator[^$<>\n]+use_emulator_local[^$<>\n]+\n")
+ message(SEND_ERROR "Did not use local emulator when it should be used. ${error_details}")
+endif()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt
index 214870e..a343053 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt
@@ -7,7 +7,7 @@ test 1
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
1: Test timeout computed to be: [0-9]+
1: Hi
-1/6 Test #1: DoesNotUseEmulator [.]* +Passed +[0-9.]+ sec
+1/7 Test #1: DoesNotUseEmulator [.]* +Passed +[0-9.]+ sec
test 2
Start 2: UsesEmulator
@@ -17,7 +17,7 @@ test 2
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
2: Test timeout computed to be: [0-9]+
2: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe(\.exe)?"
-2/6 Test #2: UsesEmulator [.]* +Passed +[0-9.]+ sec
+2/7 Test #2: UsesEmulator [.]* +Passed +[0-9.]+ sec
test 3
Start 3: DoesNotUseEmulatorWithGenex
@@ -26,7 +26,7 @@ test 3
3: Working Directory: [^
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
3: Test timeout computed to be: [0-9]+
-3/6 Test #3: DoesNotUseEmulatorWithGenex [.]* +Passed +[0-9.]+ sec
+3/7 Test #3: DoesNotUseEmulatorWithGenex [.]* +Passed +[0-9.]+ sec
test 4
Start 4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex
@@ -36,7 +36,7 @@ test 4
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
4: Test timeout computed to be: [0-9]+
4: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build/AddTest(/Debug)?/subdir_exe_no_genex(\.exe)?"
-4/6 Test #4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec
+4/7 Test #4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec
test 5
Start 5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex
@@ -45,7 +45,7 @@ test 5
5: Working Directory: [^
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
5: Test timeout computed to be: [0-9]+
-5/6 Test #5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec
+5/7 Test #5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec
test 6
Start 6: UsesTestLauncherAndEmulator
@@ -55,4 +55,14 @@ test 6
]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
6: Test timeout computed to be: [0-9]+
6: Command: "[^"]*/Tests/RunCMake(/[^/]+)?/pseudo_emulator(\.exe)?" "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe_test_launcher(\.exe)?"
-6/6 Test #6: UsesTestLauncherAndEmulator [.]* +Passed +[0-9.]+ sec
+6/7 Test #6: UsesTestLauncherAndEmulator [.]* +Passed +[0-9.]+ sec
+test 7
+ Start 7: UsesLocalEmulator
+
+7: Test command: "?[^
+]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-build([/\]Debug)?[/\]local_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/use_emulator_local(\.exe)?"
+7: Working Directory: [^
+]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build
+7: Test timeout computed to be: [0-9]+
+7: Command: "[^"]*/use_emulator_local[^"]*"
+7/7 Test #7: UsesLocalEmulator [.]* +Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
index e021d87..2d169dc 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
@@ -6,6 +6,8 @@ add_test(NAME DoesNotUseEmulator
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
add_executable(exe main.c)
+get_property(emulator TARGET exe PROPERTY CROSSCOMPILING_EMULATOR)
+set_property(TARGET exe PROPERTY CROSSCOMPILING_EMULATOR "$<1:${emulator}>")
add_test(NAME UsesEmulator
COMMAND exe)
@@ -21,8 +23,14 @@ add_test(NAME UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex
add_test(NAME DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex
COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
-set(CMAKE_TEST_LAUNCHER ${CMAKE_CROSSCOMPILING_EMULATOR})
+set(CMAKE_TEST_LAUNCHER "$<1:${CMAKE_CROSSCOMPILING_EMULATOR}>")
add_executable(exe_test_launcher main.c)
+unset(CMAKE_TEST_LAUNCHER)
add_test(NAME UsesTestLauncherAndEmulator
COMMAND exe_test_launcher)
+
+add_executable(local_emulator ../pseudo_emulator.c)
+add_executable(use_emulator_local main.c)
+set_property(TARGET use_emulator_local PROPERTY CROSSCOMPILING_EMULATOR "$<TARGET_FILE:local_emulator>")
+add_test(NAME UsesLocalEmulator COMMAND use_emulator_local)
diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
index c465297..d7d2e11 100644
--- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
@@ -47,6 +47,6 @@ if(_rdeps)
endif()
add_executable(cxx_exe_test_launcher ../empty.cxx)
-set_property(TARGET cxx_exe_test_launcher PROPERTY TEST_LAUNCHER no-such-launcher)
+set_property(TARGET cxx_exe_test_launcher PROPERTY TEST_LAUNCHER "$<1:no-such-launcher>")
add_subdirectory(cross)
diff --git a/Tests/RunCMake/FileAPI/cxx/cross/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/cross/CMakeLists.txt
index 2f2594f..b5ee38f 100644
--- a/Tests/RunCMake/FileAPI/cxx/cross/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/cxx/cross/CMakeLists.txt
@@ -7,5 +7,5 @@ add_executable(cxx_exe_cross_emulator_args ../../empty.cxx)
set_property(TARGET cxx_exe_cross_emulator_args PROPERTY CROSSCOMPILING_EMULATOR "no-such-emulator;arg1;arg2 with space")
add_executable(cxx_exe_test_launcher_and_cross_emulator ../../empty.cxx)
-set_property(TARGET cxx_exe_test_launcher_and_cross_emulator PROPERTY TEST_LAUNCHER "no-such-launcher")
-set_property(TARGET cxx_exe_test_launcher_and_cross_emulator PROPERTY CROSSCOMPILING_EMULATOR "no-such-emulator")
+set_property(TARGET cxx_exe_test_launcher_and_cross_emulator PROPERTY TEST_LAUNCHER "$<1:no-such-launcher>")
+set_property(TARGET cxx_exe_test_launcher_and_cross_emulator PROPERTY CROSSCOMPILING_EMULATOR "$<1:no-such-emulator>")
diff --git a/Tests/RunCMake/add_test/TestLauncher-check.cmake b/Tests/RunCMake/add_test/TestLauncher-check.cmake
index add1105..d1396c2 100644
--- a/Tests/RunCMake/add_test/TestLauncher-check.cmake
+++ b/Tests/RunCMake/add_test/TestLauncher-check.cmake
@@ -8,27 +8,31 @@ endif()
set(error_details "There is a problem with generated test file:\n ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}")
return()
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n")
set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}")
return()
endif()
+
+if(NOT testfile_contents MATCHES "add_test[(]UsesLocalLauncher [^$<>\n]+local_launcher[^$<>\n]+use_launcher_local[^$<>\n]+\n")
+ message(SEND_ERROR "Did not use local test launcher when it should be used. ${error_details}")
+endif()
diff --git a/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt
index 10d79d4..a028f42 100644
--- a/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt
+++ b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt
@@ -7,7 +7,7 @@ test 1
]*/Tests/RunCMake/add_test/TestLauncher-build
1: Test timeout computed to be: [0-9]+
1: Hi
-1/5 Test #1: DoesNotUseLauncher [.]* +Passed +[0-9.]+ sec
+1/6 Test #1: DoesNotUseLauncher [.]* +Passed +[0-9.]+ sec
test 2
Start 2: UsesTestLauncher
+
@@ -17,7 +17,7 @@ test 2
]*Tests/RunCMake/add_test/TestLauncher-build
2: Test timeout computed to be: [0-9]+
2: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/exe(\.exe)?"
-2/5 Test #2: UsesTestLauncher [.]* +Passed +[0-9.]+ sec
+2/6 Test #2: UsesTestLauncher [.]* +Passed +[0-9.]+ sec
test 3
Start 3: DoesNotUseTestLauncherWithGenex
+
@@ -26,7 +26,7 @@ test 3
3: Working Directory: [^
]*Tests/RunCMake/add_test/TestLauncher-build
3: Test timeout computed to be: [0-9]+
-3/5 Test #3: DoesNotUseTestLauncherWithGenex [.]* +Passed +[0-9.]+ sec
+3/6 Test #3: DoesNotUseTestLauncherWithGenex [.]* +Passed +[0-9.]+ sec
test 4
Start 4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex
+
@@ -36,7 +36,7 @@ test 4
]*Tests/RunCMake/add_test/TestLauncher-build
4: Test timeout computed to be: [0-9]+
4: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build/TestLauncher(/Debug)?/subdir_exe_no_genex(\.exe)?"
-4/5 Test #4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec
+4/6 Test #4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec
test 5
Start 5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex
+
@@ -45,4 +45,14 @@ test 5
5: Working Directory: [^
]*Tests/RunCMake/add_test/TestLauncher-build
5: Test timeout computed to be: [0-9]+
-5/5 Test #5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec
+5/6 Test #5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec
+test 6
+ Start 6: UsesLocalLauncher
+
+6: Test command: "?[^
+]*[/\]Tests[/\]RunCMake[/\]add_test[/\]TestLauncher-build([/\]Debug)?[/\]local_launcher(\.exe)?"? "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/use_launcher_local(\.exe)?"
+6: Working Directory: [^
+]*/Tests/RunCMake/add_test/TestLauncher-build
+6: Test timeout computed to be: [0-9]+
+6: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/use_launcher_local(\.exe)?"
+6/6 Test #6: UsesLocalLauncher [.]* +Passed +[0-9.]+ sec
diff --git a/Tests/RunCMake/add_test/TestLauncher.cmake b/Tests/RunCMake/add_test/TestLauncher.cmake
index 023b663..bef441d 100644
--- a/Tests/RunCMake/add_test/TestLauncher.cmake
+++ b/Tests/RunCMake/add_test/TestLauncher.cmake
@@ -5,6 +5,8 @@ add_test(NAME DoesNotUseLauncher
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
add_executable(exe main.c)
+get_property(test_launcher TARGET exe PROPERTY TEST_LAUNCHER)
+set_property(TARGET exe PROPERTY TEST_LAUNCHER "$<1:${test_launcher}>")
add_test(NAME UsesTestLauncher
COMMAND exe)
@@ -19,3 +21,8 @@ add_test(NAME UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex
add_test(NAME DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex
COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
+
+add_executable(local_launcher ../pseudo_emulator.c)
+add_executable(use_launcher_local main.c)
+set_property(TARGET use_launcher_local PROPERTY TEST_LAUNCHER "$<TARGET_FILE:local_launcher>")
+add_test(NAME UsesLocalLauncher COMMAND use_launcher_local)