|
@@ -38,6 +38,19 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
|
|
|
return static_cast<unsigned int>(this->CC.GetCommandLines().size());
|
|
|
}
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+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
|
|
|
{
|
|
@@ -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,
|