summaryrefslogtreecommitdiffstats
path: root/Source/cmTryRunCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-08 13:07:03 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-08 13:07:03 (GMT)
commit977796e3077b390b72c32315138ca15ae3339fb7 (patch)
tree78d5a827316d2d9ca59bffe7aab4713359cfcb42 /Source/cmTryRunCommand.cxx
parent37ce091345f6e9ad57aff7a768cc3dc35ebc3913 (diff)
parent1975d53ae19c46ee4f7384cc96be355f7e94df61 (diff)
downloadCMake-977796e3077b390b72c32315138ca15ae3339fb7.zip
CMake-977796e3077b390b72c32315138ca15ae3339fb7.tar.gz
CMake-977796e3077b390b72c32315138ca15ae3339fb7.tar.bz2
Merge topic 'emulator-property'
1975d53a Help: Add notes for topic 'emulator-property' 9160d6c2 TestGenerator: Add CROSSCOMPILING_EMULATOR support. e942526b try_run: Use CMAKE_CROSSCOMPILING_EMULATOR. 579c4bec Properties: Add CROSSCOMPILING_EMULATOR target property.
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r--Source/cmTryRunCommand.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index b5280cf..8b68d64 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -149,7 +149,8 @@ bool cmTryRunCommand
{
// "run" it and capture the output
std::string runOutputContents;
- if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))
+ if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") &&
+ !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR"))
{
this->DoNotRunExecutable(runArgs,
argv[3],
@@ -195,7 +196,28 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
std::string* out)
{
int retVal = -1;
- std::string finalCommand = cmSystemTools::ConvertToRunCommandPath(
+
+ std::string finalCommand;
+ const std::string emulator =
+ this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
+ if (!emulator.empty())
+ {
+ std::vector<std::string> emulatorWithArgs;
+ cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+ finalCommand += cmSystemTools::ConvertToRunCommandPath(
+ emulatorWithArgs[0].c_str());
+ finalCommand += " ";
+ for (std::vector<std::string>::const_iterator ei =
+ emulatorWithArgs.begin()+1;
+ ei != emulatorWithArgs.end(); ++ei)
+ {
+ finalCommand += "\"";
+ finalCommand += *ei;
+ finalCommand += "\"";
+ finalCommand += " ";
+ }
+ }
+ finalCommand += cmSystemTools::ConvertToRunCommandPath(
this->OutputFile.c_str());
if (!runArgs.empty())
{