summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2003-08-01 18:34:51 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2003-08-01 18:34:51 (GMT)
commit4808d9cec202bf280bf12fc4342948ee2894cf23 (patch)
tree72d470c700048b65e7799923abbff7f7be0ba71d /Source/cmLocalUnixMakefileGenerator.cxx
parent2f98c791fae6f46af4463e9eed5d5a674d6f1ddb (diff)
downloadCMake-4808d9cec202bf280bf12fc4342948ee2894cf23.zip
CMake-4808d9cec202bf280bf12fc4342948ee2894cf23.tar.gz
CMake-4808d9cec202bf280bf12fc4342948ee2894cf23.tar.bz2
BUG (85): allow . to be in the name of an executable
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx40
1 files changed, 34 insertions, 6 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 256bf57..c556f67 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -2785,21 +2785,49 @@ std::string cmLocalUnixMakefileGenerator::LowerCasePath(const char* path)
}
std::string
-cmLocalUnixMakefileGenerator::CreateMakeVariable(const char* s, const char* s2)
+cmLocalUnixMakefileGenerator::CreateMakeVariable(const char* sin, const char* s2in)
{
- if(!m_MakefileVariableSize)
- {
- return std::string(s) + std::string(s2);
- }
+ std::string s = sin;
+ std::string s2 = s2in;
std::string unmodified = s;
unmodified += s2;
- // see if th
+ // if there is no restriction on the length of make variables
+ // and there are no "." charactors in the string, then return the
+ // unmodified combination.
+ if(!m_MakefileVariableSize && unmodified.find('.') == s.npos)
+ {
+ return unmodified;
+ }
+
+ // see if the variable has been defined before and return
+ // the modified version of the variable
std::map<cmStdString, cmStdString>::iterator i = m_MakeVariableMap.find(unmodified);
if(i != m_MakeVariableMap.end())
{
return i->second;
}
+ // start with the unmodified variable
std::string ret = unmodified;
+ // if this there is no value for m_MakefileVariableSize then
+ // the string must have bad characters in it
+ if(!m_MakefileVariableSize)
+ {
+ cmSystemTools::ReplaceString(ret, ".", "_");
+ int ni = 0;
+ char buffer[5];
+ // make sure the _ version is not already used, if
+ // it is used then add number to the end of the variable
+ while(m_ShortMakeVariableMap.count(ret) && ni < 1000)
+ {
+ ++ni;
+ sprintf(buffer, "%04d", ni);
+ ret = unmodified + buffer;
+ }
+ m_ShortMakeVariableMap[ret] = "1";
+ m_MakeVariableMap[unmodified] = ret;
+ return ret;
+ }
+
// if the string is greater the 32 chars it is an invalid vairable name
// for borland make
if(static_cast<int>(ret.size()) > m_MakefileVariableSize)