summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-09-23 15:44:17 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-09-23 15:44:17 (GMT)
commita7e20abcdbeeb1d6bd0270a673f4de2fa1a18eb4 (patch)
treed8e659b4dad9a3eff07f094e526b17487daa4c47
parentd11cecab7d29e6ba5a8bdc7ad290a97edd276939 (diff)
downloadCMake-a7e20abcdbeeb1d6bd0270a673f4de2fa1a18eb4.zip
CMake-a7e20abcdbeeb1d6bd0270a673f4de2fa1a18eb4.tar.gz
CMake-a7e20abcdbeeb1d6bd0270a673f4de2fa1a18eb4.tar.bz2
ENH: only replace the language being used in expand rule variables
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx41
-rw-r--r--Source/cmLocalUnixMakefileGenerator.h1
2 files changed, 29 insertions, 13 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 0bd28dd..9091652 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -996,6 +996,7 @@ static const char* ruleReplaceVars[] =
void
cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
+ const char* lang,
const char* objects,
const char* target,
const char* linkLibs,
@@ -1065,11 +1066,19 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
}
if(targetSOName)
{
- if(m_Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"))
+ bool replaced = false;
+ if(lang)
{
- cmSystemTools::ReplaceString(s, "<TARGET_SONAME>", targetSOName);
+ std::string name = "CMAKE_SHARED_LIBRARY_SONAME_";
+ name += lang;
+ name += "_FLAG";
+ if(m_Makefile->GetDefinition(name.c_str()))
+ {
+ replaced = true;
+ cmSystemTools::ReplaceString(s, "<TARGET_SONAME>", targetSOName);
+ }
}
- else
+ if(!replaced)
{
cmSystemTools::ReplaceString(s, "<TARGET_SONAME>", "");
}
@@ -1083,29 +1092,32 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
int pos = 0;
while(ruleReplaceVars[pos])
{
- std::string replace = "<";
- replace += ruleReplaceVars[pos];
- replace += ">";
- std::string replaceWith = ruleReplaceVars[pos];
- for(std::vector<std::string>::iterator i = enabledLanguages.begin();
- i != enabledLanguages.end(); ++i)
+ if(lang)
{
+ std::string replace = "<";
+ replace += ruleReplaceVars[pos];
+ replace += ">";
+ std::string replaceWith = ruleReplaceVars[pos];
std::string actualReplace = replace;
- cmSystemTools::ReplaceString(actualReplace, "${LANG}", i->c_str());
+ cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
std::string actualReplaceWith = replaceWith;
- cmSystemTools::ReplaceString(actualReplaceWith, "${LANG}", i->c_str());
+ cmSystemTools::ReplaceString(actualReplaceWith, "${LANG}", lang);
replace = m_Makefile->GetSafeDefinition(actualReplaceWith.c_str());
// if the variable is not a FLAG then treat it like a path
if(actualReplaceWith.find("_FLAG") == actualReplaceWith.npos)
{
replace = this->ConvertToOutputForExisting(replace.c_str());
}
- cmSystemTools::ReplaceString(s, actualReplace.c_str(), replace.c_str());
+ if(actualReplace.size())
+ {
+ cmSystemTools::ReplaceString(s, actualReplace.c_str(), replace.c_str());
+ }
+ pos++;
}
- pos++;
}
}
+
void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
const char* name,
@@ -1238,6 +1250,7 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
i != commands.end(); ++i)
{
this->ExpandRuleVariables(*i,
+ t.GetLinkerLanguage(m_GlobalGenerator),
objs.c_str(),
targetFullPathReal.c_str(),
linklibs.str().c_str(),
@@ -1502,6 +1515,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
i != commands.end(); ++i)
{
this->ExpandRuleVariables(*i,
+ linkLanguage,
objs.c_str(),
target.c_str(),
linklibs.str().c_str(),
@@ -2897,6 +2911,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
i != commands.end(); ++i)
{
this->ExpandRuleVariables(*i,
+ lang,
0, // no objects
0, // no target
0, // no link libs
diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h
index 832afd6..8a87228 100644
--- a/Source/cmLocalUnixMakefileGenerator.h
+++ b/Source/cmLocalUnixMakefileGenerator.h
@@ -104,6 +104,7 @@ protected:
const char* linkFlags
);
void ExpandRuleVariables(std::string& string,
+ const char* language,
const char* objects=0,
const char* target=0,
const char* linkLibs=0,