BUG (85): allow . to be in the name of an executable
This commit is contained in:
parent
2f98c791fa
commit
4808d9cec2
@ -2785,21 +2785,49 @@ std::string cmLocalUnixMakefileGenerator::LowerCasePath(const char* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmLocalUnixMakefileGenerator::CreateMakeVariable(const char* s, const char* s2)
|
cmLocalUnixMakefileGenerator::CreateMakeVariable(const char* sin, const char* s2in)
|
||||||
{
|
{
|
||||||
if(!m_MakefileVariableSize)
|
std::string s = sin;
|
||||||
{
|
std::string s2 = s2in;
|
||||||
return std::string(s) + std::string(s2);
|
|
||||||
}
|
|
||||||
std::string unmodified = s;
|
std::string unmodified = s;
|
||||||
unmodified += s2;
|
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);
|
std::map<cmStdString, cmStdString>::iterator i = m_MakeVariableMap.find(unmodified);
|
||||||
if(i != m_MakeVariableMap.end())
|
if(i != m_MakeVariableMap.end())
|
||||||
{
|
{
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
// start with the unmodified variable
|
||||||
std::string ret = unmodified;
|
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
|
// if the string is greater the 32 chars it is an invalid vairable name
|
||||||
// for borland make
|
// for borland make
|
||||||
if(static_cast<int>(ret.size()) > m_MakefileVariableSize)
|
if(static_cast<int>(ret.size()) > m_MakefileVariableSize)
|
||||||
|
@ -13,6 +13,7 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
|
|||||||
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
||||||
ELSE(UNIX)
|
ELSE(UNIX)
|
||||||
|
@ -13,6 +13,7 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
|
|||||||
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
||||||
ELSE(UNIX)
|
ELSE(UNIX)
|
||||||
|
@ -13,6 +13,7 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
|
|||||||
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys ${CMAKE_DL_LIBS})
|
||||||
ELSE(UNIX)
|
ELSE(UNIX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user