summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b71e53f..eb36a4f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -833,6 +833,15 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
{
lang = i->c_str();
std::string actualReplace = ruleReplaceVars[pos];
+ // If this is the compiler then look for the extra variable
+ // _COMPILER_ARG1 which must be the first argument to the compiler
+ const char* compilerArg1 = 0;
+ if(actualReplace == "CMAKE_${LANG}_COMPILER")
+ {
+ std::string arg1 = actualReplace + "_ARG1";
+ cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
+ compilerArg1 = m_Makefile->GetDefinition(arg1.c_str());
+ }
if(actualReplace.find("${LANG}") != actualReplace.npos)
{
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
@@ -843,7 +852,14 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
// if the variable is not a FLAG then treat it like a path
if(variable.find("_FLAG") == variable.npos)
{
- return this->ConvertToOutputForExisting(replace.c_str());
+ std::string ret = this->ConvertToOutputForExisting(replace.c_str());
+ // if there is a required first argument to the compiler add it to the compiler string
+ if(compilerArg1)
+ {
+ ret += " ";
+ ret += compilerArg1;
+ }
+ return ret;
}
return replace;
}