summaryrefslogtreecommitdiff
path: root/Source/cmTestGenerator.cxx
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-03-28 22:05:35 -0400
committerBrad King <brad.king@kitware.com>2015-04-08 09:06:22 -0400
commit9160d6c241adaeacc106d5b2ce4530f223345f22 (patch)
tree9007dabd5a565f77590a4ee20ca14b33c9d79196 /Source/cmTestGenerator.cxx
parente942526b3d9e886da4ce832d9d3adb99cc5ede2f (diff)
downloadcmake-9160d6c241adaeacc106d5b2ce4530f223345f22.tar.gz
TestGenerator: Add CROSSCOMPILING_EMULATOR support.
Prefix test commands with the CROSSCOMPILING_EMULATOR property for target executables. This allows test suites to be run on the host when crosscompiling.
Diffstat (limited to 'Source/cmTestGenerator.cxx')
-rw-r--r--Source/cmTestGenerator.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index f87a5353f0..add80fa688 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -82,11 +82,31 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// be translated.
std::string exe = command[0];
cmMakefile* mf = this->Test->GetMakefile();
+ cmLocalGenerator* lg = mf->GetLocalGenerator();
cmTarget* target = mf->FindTargetToUse(exe);
if(target && target->GetType() == cmTarget::EXECUTABLE)
{
// Use the target file on disk.
exe = target->GetFullPath(config);
+
+ // Prepend with the emulator when cross compiling if required.
+ const char * emulator =
+ target->GetProperty("CROSSCOMPILING_EMULATOR");
+ if (emulator != 0)
+ {
+ std::vector<std::string> emulatorWithArgs;
+ cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+ std::string emulatorExe(emulatorWithArgs[0]);
+ cmSystemTools::ConvertToUnixSlashes(emulatorExe);
+ os << lg->EscapeForCMake(emulatorExe) << " ";
+ for(std::vector<std::string>::const_iterator ei =
+ emulatorWithArgs.begin()+1;
+ ei != emulatorWithArgs.end();
+ ++ei)
+ {
+ os << lg->EscapeForCMake(*ei) << " ";
+ }
+ }
}
else
{
@@ -96,7 +116,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
// Generate the command line with full escapes.
- cmLocalGenerator* lg = mf->GetLocalGenerator();
os << lg->EscapeForCMake(exe);
for(std::vector<std::string>::const_iterator ci = command.begin()+1;
ci != command.end(); ++ci)