summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Source/cmTestGenerator.cxx12
-rw-r--r--Source/cmake.cxx10
3 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 169d808..832bf57 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -594,6 +594,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "CROSSCOMPILING_EMULATOR"_s, IC::ExecutableTarget },
{ "EXPORT_COMPILE_COMMANDS"_s, IC::CanCompileSources },
{ "FOLDER"_s },
+ { "TEST_LAUNCHER"_s, IC::ExecutableTarget },
// Xcode properties
{ "XCODE_GENERATE_SCHEME"_s, IC::NeedsXcode },
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index ca1226a..2831d0d 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -168,6 +168,18 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Use the target file on disk.
exe = target->GetFullPath(config);
+ // Prepend with the test launcher if specified.
+ cmValue launcher = target->GetProperty("TEST_LAUNCHER");
+ if (cmNonempty(launcher)) {
+ cmList launcherWithArgs{ *launcher };
+ std::string launcherExe(launcherWithArgs[0]);
+ cmSystemTools::ConvertToUnixSlashes(launcherExe);
+ os << cmOutputConverter::EscapeForCMake(launcherExe) << " ";
+ for (std::string const& arg : cmMakeRange(launcherWithArgs).advance(1)) {
+ os << cmOutputConverter::EscapeForCMake(arg) << " ";
+ }
+ }
+
// Prepend with the emulator when cross compiling if required.
cmValue emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
if (cmNonempty(emulator)) {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 002a020..bcba7f8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2517,6 +2517,16 @@ int cmake::ActualConfigure()
"Name of generator toolset.", cmStateEnums::INTERNAL);
}
+ if (!this->State->GetInitializedCacheValue("CMAKE_TEST_LAUNCHER")) {
+ cm::optional<std::string> testLauncher =
+ cmSystemTools::GetEnvVar("CMAKE_TEST_LAUNCHER");
+ if (testLauncher && !testLauncher->empty()) {
+ std::string message = "Test launcher to run tests executable.";
+ this->AddCacheEntry("CMAKE_TEST_LAUNCHER", *testLauncher, message,
+ cmStateEnums::STRING);
+ }
+ }
+
if (!this->State->GetInitializedCacheValue(
"CMAKE_CROSSCOMPILING_EMULATOR")) {
cm::optional<std::string> emulator =