summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-03-29 02:05:35 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-08 13:06:22 (GMT)
commit9160d6c241adaeacc106d5b2ce4530f223345f22 (patch)
tree9007dabd5a565f77590a4ee20ca14b33c9d79196 /Source
parente942526b3d9e886da4ce832d9d3adb99cc5ede2f (diff)
downloadCMake-9160d6c241adaeacc106d5b2ce4530f223345f22.zip
CMake-9160d6c241adaeacc106d5b2ce4530f223345f22.tar.gz
CMake-9160d6c241adaeacc106d5b2ce4530f223345f22.tar.bz2
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')
-rw-r--r--Source/cmTestGenerator.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index f87a535..add80fa 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)