summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-31 21:55:49 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-31 21:55:49 (GMT)
commit368d7f7c185b8d6b8d0ab5c0e173cf5b59e75749 (patch)
tree9d1ccd9ddacb83eae6e30fdce0cc005fbad375b5
parentba707ce32dd107191b892f03226488a96c52ec4b (diff)
downloadCMake-368d7f7c185b8d6b8d0ab5c0e173cf5b59e75749.zip
CMake-368d7f7c185b8d6b8d0ab5c0e173cf5b59e75749.tar.gz
CMake-368d7f7c185b8d6b8d0ab5c0e173cf5b59e75749.tar.bz2
ENH: Attempt to add debug library postfix for visual studio 6
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx47
-rw-r--r--Templates/DLLHeader.dsptemplate4
-rw-r--r--Templates/EXEHeader.dsptemplate2
-rw-r--r--Templates/EXEWinHeader.dsptemplate2
-rw-r--r--Templates/staticLibHeader.dsptemplate1
-rw-r--r--Tests/COnly/CMakeLists.txt2
6 files changed, 54 insertions, 4 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 4d56017..011f8cf 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -20,6 +20,7 @@
#include "cmSystemTools.h"
#include "cmSourceFile.h"
#include "cmCacheManager.h"
+#include "cmake.h"
#include <cmsys/RegularExpression.hxx>
@@ -732,6 +733,7 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
std::string libOptimizedOptions;
std::string libMultiLineOptions;
+ std::string libMultiLineOptionsForDebug;
std::string libMultiLineDebugOptions;
std::string libMultiLineOptimizedOptions;
@@ -772,6 +774,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath;
libMultiLineOptions += " \n";
+ libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
+ libMultiLineOptionsForDebug += lpathIntDir;
+ libMultiLineOptionsForDebug += " ";
+ libMultiLineOptionsForDebug += " /LIBPATH:";
+ libMultiLineOptionsForDebug += lpath;
+ libMultiLineOptionsForDebug += " \n";
}
}
if(exePath.size())
@@ -800,6 +808,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath;
libMultiLineOptions += " \n";
+ libMultiLineOptionsForDebug += "# ADD LINK32 /LIBPATH:";
+ libMultiLineOptionsForDebug += lpathIntDir;
+ libMultiLineOptionsForDebug += " ";
+ libMultiLineOptionsForDebug += " /LIBPATH:";
+ libMultiLineOptionsForDebug += lpath;
+ libMultiLineOptionsForDebug += " \n";
}
}
std::vector<std::string>::const_iterator i;
@@ -830,6 +844,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += " /LIBPATH:";
libMultiLineOptions += lpath;
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))
{
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)
{
lib += ".lib";
+ libDebug += ".lib";
}
lib = cmSystemTools::ConvertToOutputPath(lib.c_str());
@@ -861,6 +891,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += lib;
libMultiLineOptions += "\n";
+ libMultiLineOptionsForDebug += "# ADD LINK32 ";
+ libMultiLineOptionsForDebug += libDebug;
+ libMultiLineOptionsForDebug += "\n";
}
if (j->second == cmTarget::DEBUG)
{
@@ -868,7 +901,7 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libDebugOptions += lib;
libMultiLineDebugOptions += "# ADD LINK32 ";
- libMultiLineDebugOptions += lib;
+ libMultiLineDebugOptions += libDebug;
libMultiLineDebugOptions += "\n";
}
if (j->second == cmTarget::OPTIMIZED)
@@ -904,6 +937,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += extraLinkOptions;
libMultiLineOptions += " \n";
+ libMultiLineOptionsForDebug += "# ADD LINK32 ";
+ libMultiLineOptionsForDebug += extraLinkOptions;
+ libMultiLineOptionsForDebug += " \n";
}
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"))
@@ -914,6 +950,9 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libMultiLineOptions += "# ADD LINK32 ";
libMultiLineOptions += targetLinkFlags;
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",
libOptimizedOptions.c_str());
+ cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES_FOR_DEBUG",
+ libMultiLineOptionsForDebug.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES",
libMultiLineOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES",
@@ -970,6 +1011,10 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES",
m_Makefile->GetDefineFlags());
+ const char* debugPostfix
+ = m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
+ cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
+ debugPostfix?debugPostfix:"");
cmGlobalGenerator* gen = this->GetGlobalGenerator();
// store flags for each configuration
std::string flags = " ";
diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate
index 2e4a13d..cbb7ee0 100644
--- a/Templates/DLLHeader.dsptemplate
+++ b/Templates/DLLHeader.dsptemplate
@@ -102,7 +102,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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 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
diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate
index 190b854..f2eccb6 100644
--- a/Templates/EXEHeader.dsptemplate
+++ b/Templates/EXEHeader.dsptemplate
@@ -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 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_LIBRARIES
+CM_MULTILINE_LIBRARIES_FOR_DEBUG
CMAKE_CUSTOM_RULE_CODE
diff --git a/Templates/EXEWinHeader.dsptemplate b/Templates/EXEWinHeader.dsptemplate
index 9c4bcbd..d34b437 100644
--- a/Templates/EXEWinHeader.dsptemplate
+++ b/Templates/EXEWinHeader.dsptemplate
@@ -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 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_LIBRARIES
+CM_MULTILINE_LIBRARIES_FOR_DEBUG
CMAKE_CUSTOM_RULE_CODE
diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate
index 3aef2c3..39de7fc 100644
--- a/Templates/staticLibHeader.dsptemplate
+++ b/Templates/staticLibHeader.dsptemplate
@@ -93,6 +93,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHDebug\OUTPUT_LIBNAMEDEBUG_POSTFIX.lib"
CMAKE_CUSTOM_RULE_CODE
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt
index 2386c23..228eecb 100644
--- a/Tests/COnly/CMakeLists.txt
+++ b/Tests/COnly/CMakeLists.txt
@@ -1,5 +1,7 @@
# a simple C only test case
PROJECT (conly C)
+
+SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
ADD_LIBRARY(testc1 STATIC libc1.c)
ADD_LIBRARY(testc2 SHARED libc2.c)
ADD_EXECUTABLE (conly conly.c foo.c foo.h)