diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-20 19:44:55 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-20 19:44:55 (GMT) |
commit | b8b298104b18486e65fd40ae410a327d9e6fe8f3 (patch) | |
tree | d447d9b5cbf635545721fd27046e9520e02f0a4b /Source/cmLocalGenerator.cxx | |
parent | ff250565a2316b6bd639fba2db1c8180a8f590db (diff) | |
download | CMake-b8b298104b18486e65fd40ae410a327d9e6fe8f3.zip CMake-b8b298104b18486e65fd40ae410a327d9e6fe8f3.tar.gz CMake-b8b298104b18486e65fd40ae410a327d9e6fe8f3.tar.bz2 |
ENH: make sure flags set in CC or CXX environment variables stay with the compiler
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 18 |
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; } |