diff options
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 5d3a1ce..81c5142 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -39,6 +39,19 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const } //---------------------------------------------------------------------------- +bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const +{ + std::string const& argv0 = this->CC.GetCommandLines()[c][0]; + cmGeneratorTarget* target = + this->LG->FindGeneratorTargetToUse(argv0); + if(target && target->GetType() == cmState::EXECUTABLE) + { + return target->GetProperty("CROSSCOMPILING_EMULATOR") != 0; + } + return false; +} + +//---------------------------------------------------------------------------- std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; @@ -50,7 +63,19 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - return this->GE->Parse(argv0)->Evaluate(this->LG, this->Config); + if (target && target->GetType() == cmState::EXECUTABLE) + { + const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR"); + if (emulator) + { + return std::string(emulator); + } + } + + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); + std::string exe = cge->Evaluate(this->LG, this->Config); + + return exe; } //---------------------------------------------------------------------------- @@ -87,8 +112,13 @@ void cmCustomCommandGenerator ::AppendArguments(unsigned int c, std::string& cmd) const { + unsigned int offset = 1; + if (this->UseCrossCompilingEmulator(c)) + { + offset = 0; + } cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; - for(unsigned int j=1;j < commandLine.size(); ++j) + for(unsigned int j=offset;j < commandLine.size(); ++j) { std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->LG, |