From ea8dc0769d58b6e713f140416215a038655cbb5d Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 4 May 2004 11:24:32 -0400 Subject: ENH: Only mangle object files if CMAKE_MANGLE_OBJECT_FILE_NAMES is set. Only on borland for now. --- Modules/Platform/Windows-bcc32.cmake | 2 ++ Source/cmLocalUnixMakefileGenerator.cxx | 61 ++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/Modules/Platform/Windows-bcc32.cmake b/Modules/Platform/Windows-bcc32.cmake index 65c728f..c945195 100644 --- a/Modules/Platform/Windows-bcc32.cmake +++ b/Modules/Platform/Windows-bcc32.cmake @@ -21,6 +21,8 @@ SET(BORLAND 1) #SET(CMAKE_END_TEMP_FILE "") #SET(CMAKE_VERBOSE_MAKEFILE 1) +# Borland cannot handle + in the file name, so mangle object file name +SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") # create a shared C++ library SET(CMAKE_CXX_CREATE_SHARED_LIBRARY diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index 34de3ca..f7bd1bb 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -3077,38 +3077,45 @@ std::string cmLocalUnixMakefileGenerator::LowerCasePath(const char* path) std::string& cmLocalUnixMakefileGenerator::CreateSafeUniqueObjectFileName(const char* sin) { - std::map::iterator it = m_UniqueObjectNamesMap.find(sin); - if ( it == m_UniqueObjectNamesMap.end() ) - { - std::string ssin = sin; - bool done; - int cc = 0; - char rpstr[100]; - sprintf(rpstr, "_p_"); - cmSystemTools::ReplaceString(ssin, "+", rpstr); - std::string sssin = sin; - do - { - done = true; - for ( it = m_UniqueObjectNamesMap.begin(); - it != m_UniqueObjectNamesMap.end(); - ++ it ) + if ( m_Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES") ) + { + std::map::iterator it = m_UniqueObjectNamesMap.find(sin); + if ( it == m_UniqueObjectNamesMap.end() ) + { + std::string ssin = sin; + bool done; + int cc = 0; + char rpstr[100]; + sprintf(rpstr, "_p_"); + cmSystemTools::ReplaceString(ssin, "+", rpstr); + std::string sssin = sin; + do { - if ( it->second == ssin ) + done = true; + for ( it = m_UniqueObjectNamesMap.begin(); + it != m_UniqueObjectNamesMap.end(); + ++ it ) { - done = false; + if ( it->second == ssin ) + { + done = false; + } } + if ( done ) + { + break; + } + sssin = ssin; + cmSystemTools::ReplaceString(ssin, "_p_", rpstr); + sprintf(rpstr, "_p%d_", cc++); } - if ( done ) - { - break; - } - sssin = ssin; - cmSystemTools::ReplaceString(ssin, "_p_", rpstr); - sprintf(rpstr, "_p%d_", cc++); + while ( !done ); + m_UniqueObjectNamesMap[sin] = ssin; } - while ( !done ); - m_UniqueObjectNamesMap[sin] = ssin; + } + else + { + m_UniqueObjectNamesMap[sin] = sin; } return m_UniqueObjectNamesMap[sin]; } -- cgit v0.12