ENH: Attempt to add debug library postfix for visual studio 6

This commit is contained in:
Andy Cedilnik 2003-10-31 16:55:49 -05:00
parent ba707ce32d
commit 368d7f7c18
6 changed files with 54 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmCacheManager.h" #include "cmCacheManager.h"
#include "cmake.h"
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
@ -732,6 +733,7 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
std::string libOptimizedOptions; std::string libOptimizedOptions;
std::string libMultiLineOptions; std::string libMultiLineOptions;
std::string libMultiLineOptionsForDebug;
std::string libMultiLineDebugOptions; std::string libMultiLineDebugOptions;
std::string libMultiLineOptimizedOptions; std::string libMultiLineOptimizedOptions;
@ -772,6 +774,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath; libMultiLineOptions += lpath;
libMultiLineOptions += " \n"; libMultiLineOptions += " \n";
libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
libMultiLineOptionsForDebug += lpathIntDir;
libMultiLineOptionsForDebug += " ";
libMultiLineOptionsForDebug += " /LIBPATH:";
libMultiLineOptionsForDebug += lpath;
libMultiLineOptionsForDebug += " \n";
} }
} }
if(exePath.size()) if(exePath.size())
@ -800,6 +808,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath; libMultiLineOptions += lpath;
libMultiLineOptions += " \n"; libMultiLineOptions += " \n";
libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
libMultiLineOptionsForDebug += lpathIntDir;
libMultiLineOptionsForDebug += " ";
libMultiLineOptionsForDebug += " /LIBPATH:";
libMultiLineOptionsForDebug += lpath;
libMultiLineOptionsForDebug += " \n";
} }
} }
std::vector<std::string>::const_iterator i; std::vector<std::string>::const_iterator i;
@ -830,6 +844,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath; libMultiLineOptions += lpath;
libMultiLineOptions += " \n"; libMultiLineOptions += " \n";
libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
libMultiLineOptionsForDebug += lpathIntDir;
libMultiLineOptionsForDebug += " ";
libMultiLineOptionsForDebug += " /LIBPATH:";
libMultiLineOptionsForDebug += lpath;
libMultiLineOptionsForDebug += " \n";
} }
} }
@ -847,9 +867,19 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
(target.GetType()==cmTarget::MODULE_LIBRARY && libName != j->first)) (target.GetType()==cmTarget::MODULE_LIBRARY && libName != j->first))
{ {
std::string lib = j->first; std::string lib = j->first;
std::string libDebug = j->first;
std::string libPath = j->first + "_CMAKE_PATH";
const char* cacheValue
= m_GlobalGenerator->GetCMakeInstance()->GetCacheDefinition(
libPath.c_str());
if ( cacheValue && m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX") )
{
libDebug += m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
}
if(j->first.find(".lib") == std::string::npos) if(j->first.find(".lib") == std::string::npos)
{ {
lib += ".lib"; lib += ".lib";
libDebug += ".lib";
} }
lib = cmSystemTools::ConvertToOutputPath(lib.c_str()); lib = cmSystemTools::ConvertToOutputPath(lib.c_str());
@ -861,6 +891,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 "; libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += lib; libMultiLineOptions += lib;
libMultiLineOptions += "\n"; libMultiLineOptions += "\n";
libMultiLineOptionsForDebug += "# ADD LINK32 ";
libMultiLineOptionsForDebug += libDebug;
libMultiLineOptionsForDebug += "\n";
} }
if (j->second == cmTarget::DEBUG) if (j->second == cmTarget::DEBUG)
{ {
@ -868,7 +901,7 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libDebugOptions += lib; libDebugOptions += lib;
libMultiLineDebugOptions += "# ADD LINK32 "; libMultiLineDebugOptions += "# ADD LINK32 ";
libMultiLineDebugOptions += lib; libMultiLineDebugOptions += libDebug;
libMultiLineDebugOptions += "\n"; libMultiLineDebugOptions += "\n";
} }
if (j->second == cmTarget::OPTIMIZED) if (j->second == cmTarget::OPTIMIZED)
@ -904,6 +937,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 "; libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += extraLinkOptions; libMultiLineOptions += extraLinkOptions;
libMultiLineOptions += " \n"; libMultiLineOptions += " \n";
libMultiLineOptionsForDebug += "# ADD LINK32 ";
libMultiLineOptionsForDebug += extraLinkOptions;
libMultiLineOptionsForDebug += " \n";
} }
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS")) if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"))
@ -914,6 +950,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 "; libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += targetLinkFlags; libMultiLineOptions += targetLinkFlags;
libMultiLineOptions += " \n"; libMultiLineOptions += " \n";
libMultiLineOptionsForDebug += "# ADD LINK32 ";
libMultiLineOptionsForDebug += targetLinkFlags;
libMultiLineOptionsForDebug += " \n";
} }
@ -947,6 +986,8 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
libOptimizedOptions.c_str()); libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES_FOR_DEBUG",
libMultiLineOptionsForDebug.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES",
libMultiLineOptions.c_str()); libMultiLineOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES",
@ -970,6 +1011,10 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
cmSystemTools::ReplaceString(line, cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES", "EXTRA_DEFINES",
m_Makefile->GetDefineFlags()); m_Makefile->GetDefineFlags());
const char* debugPostfix
= m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
debugPostfix?debugPostfix:"");
cmGlobalGenerator* gen = this->GetGlobalGenerator(); cmGlobalGenerator* gen = this->GetGlobalGenerator();
// store flags for each configuration // store flags for each configuration
std::string flags = " "; std::string flags = " ";

View File

@ -102,7 +102,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 CM_DEBUG_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES_FOR_DEBUG
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_LIBNAMEDEBUG_POSTFIX.dll" /pdbtype:sept
CMAKE_CUSTOM_RULE_CODE CMAKE_CUSTOM_RULE_CODE

View File

@ -102,7 +102,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
CM_MULTILINE_DEBUG_LIBRARIES CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES CM_MULTILINE_LIBRARIES_FOR_DEBUG
CMAKE_CUSTOM_RULE_CODE CMAKE_CUSTOM_RULE_CODE

View File

@ -104,7 +104,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089
CM_MULTILINE_DEBUG_LIBRARIES CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES CM_MULTILINE_LIBRARIES_FOR_DEBUG
CMAKE_CUSTOM_RULE_CODE CMAKE_CUSTOM_RULE_CODE

View File

@ -93,6 +93,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHDebug\OUTPUT_LIBNAMEDEBUG_POSTFIX.lib"
CMAKE_CUSTOM_RULE_CODE CMAKE_CUSTOM_RULE_CODE

View File

@ -1,5 +1,7 @@
# a simple C only test case # a simple C only test case
PROJECT (conly C) PROJECT (conly C)
SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
ADD_LIBRARY(testc1 STATIC libc1.c) ADD_LIBRARY(testc1 STATIC libc1.c)
ADD_LIBRARY(testc2 SHARED libc2.c) ADD_LIBRARY(testc2 SHARED libc2.c)
ADD_EXECUTABLE (conly conly.c foo.c foo.h) ADD_EXECUTABLE (conly conly.c foo.c foo.h)