summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/DLLHeader.dsptemplate4
-rw-r--r--Source/EXEHeader.dsptemplate6
-rw-r--r--Source/MFCDialog/CMakeSetup.rc15
-rw-r--r--Source/MFCDialog/resource.h3
-rw-r--r--Source/cmDSPMakefile.cxx94
-rw-r--r--Source/cmDSPMakefile.h7
-rw-r--r--Source/cmDSPWriter.cxx94
-rw-r--r--Source/cmDSPWriter.h7
-rw-r--r--Source/cmDSWMakefile.cxx15
-rw-r--r--Source/cmDSWWriter.cxx15
-rw-r--r--Source/cmLinkLibrariesCommand.cxx19
-rw-r--r--Source/cmLinkLibrariesCommand.h7
-rw-r--r--Source/cmMakefile.cxx18
-rw-r--r--Source/cmMakefile.h21
-rw-r--r--Source/cmUnixMakefileGenerator.cxx27
-rw-r--r--Source/cmVTKWrapPythonCommand.cxx4
16 files changed, 214 insertions, 142 deletions
diff --git a/Source/DLLHeader.dsptemplate b/Source/DLLHeader.dsptemplate
index 81870bb..23387c1 100644
--- a/Source/DLLHeader.dsptemplate
+++ b/Source/DLLHeader.dsptemplate
@@ -68,7 +68,7 @@ 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 /machine:I386
-# ADD LINK32 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 /machine:I386
+# ADD LINK32 CM_OPTIMIZED_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 /machine:I386
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug"
@@ -95,7 +95,7 @@ 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_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
+# 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
!ENDIF
diff --git a/Source/EXEHeader.dsptemplate b/Source/EXEHeader.dsptemplate
index 64c4cb5..c2e1f29 100644
--- a/Source/EXEHeader.dsptemplate
+++ b/Source/EXEHeader.dsptemplate
@@ -63,7 +63,7 @@ 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 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 /machine:I386 /IGNORE:4089
-# ADD LINK32 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 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 /machine:I386 /IGNORE:4089
+# ADD LINK32 CM_OPTIMIZED_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 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 /machine:I386 /IGNORE:4089
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug"
@@ -88,7 +88,7 @@ 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 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 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 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 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 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
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Release MinSize"
# PROP BASE Use_MFC 0
@@ -110,7 +110,7 @@ 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 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 /machine:I386 /IGNORE:4089
-# ADD LINK32 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 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 /machine:I386 /IGNORE:4089
+# ADD LINK32 CM_OPTIMIZED_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 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 /machine:I386 /IGNORE:4089
!ENDIF
diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc
index 4e45876..28318e7 100644
--- a/Source/MFCDialog/CMakeSetup.rc
+++ b/Source/MFCDialog/CMakeSetup.rc
@@ -91,7 +91,7 @@ EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif"
BEGIN
- DEFPUSHBUTTON "Close",IDOK,319,39,50,14
+ DEFPUSHBUTTON "Close",IDOK,231,206,50,14
EDITTEXT IDC_WhereSource,129,4,135,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON2,269,5,43,13
LTEXT "Where is the source code:",IDC_STATIC,39,6,86,9
@@ -99,11 +99,13 @@ BEGIN
PUSHBUTTON "Browse...",IDC_BUTTON3,268,25,43,13
LTEXT "Where do you want to build the binaries:",IDC_STATIC,1,
27,128,9
- PUSHBUTTON "Build Project Files",IDC_BuildProjects,6,39,67,15
- GROUPBOX "Cache Values",IDC_STATIC,2,67,370,156
- LISTBOX IDC_LIST2,13,84,344,122,LBS_OWNERDRAWVARIABLE |
+ PUSHBUTTON "Build Project Files",IDC_BuildProjects,81,205,67,15
+ GROUPBOX "Cache Values",IDC_STATIC,9,43,356,141
+ LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
+ CTEXT "Right click on cache entries for additional options",
+ IDC_STATIC,19,190,333,11
END
@@ -165,11 +167,6 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
-
- IDD_CMakeSetupDialog_DIALOG, DIALOG
- BEGIN
- BOTTOMMARGIN, 215
- END
END
#endif // APSTUDIO_INVOKED
diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h
index 682c50c..3e1aa31 100644
--- a/Source/MFCDialog/resource.h
+++ b/Source/MFCDialog/resource.h
@@ -13,6 +13,7 @@
#define IDC_BUTTON3 1004
#define IDC_BuildProjects 1006
#define IDC_LIST2 1007
+#define IDC_LIST3 1010
// Next default values for new objects
//
@@ -20,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1008
+#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx
index 22dc798..1efbcc8 100644
--- a/Source/cmDSPMakefile.cxx
+++ b/Source/cmDSPMakefile.cxx
@@ -53,10 +53,8 @@ void cmDSPMakefile::OutputDSPFile()
}
// Create the DSP or set of DSP's for libraries and executables
- const char* cacheValue
- = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
m_LibraryBuildType = STATIC_LIBRARY;
- if(cacheValue && strcmp(cacheValue,"0"))
+ if(cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"))
{
m_LibraryBuildType = DLL;
}
@@ -69,30 +67,6 @@ void cmDSPMakefile::OutputDSPFile()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
- std::string libOptions;
- std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
- for(i = libdirs.begin(); i != libdirs.end(); ++i)
- {
- libOptions += " /LIBPATH:\"";
- libOptions += *i;
- libOptions += "/$(OUTDIR)\" ";
- libOptions += " /LIBPATH:\"";
- libOptions += *i;
- libOptions += "\" ";
- }
- std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
- for(i = libs.begin(); i != libs.end(); ++i)
- {
- // add libraries to executables and dlls (but never include
- // a library in a library, bad recursion)
- if (!l->second.IsALibrary() ||
- (m_LibraryBuildType == DLL && l->first.c_str() != *i))
- {
- libOptions += " ";
- libOptions += *i;
- libOptions += ".lib ";
- }
- }
if (l->second.IsALibrary())
{
this->SetBuildType(m_LibraryBuildType, l->first.c_str());
@@ -101,13 +75,11 @@ void cmDSPMakefile::OutputDSPFile()
{
this->SetBuildType(EXECUTABLE,l->first.c_str());
}
- libOptions += "/STACK:10000000 ";
- this->CreateSingleDSP(l->first.c_str(),l->second, libOptions);
+ this->CreateSingleDSP(l->first.c_str(),l->second);
}
}
-void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
- const std::string &libOptions)
+void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
{
std::string fname;
fname = m_Makefile->GetStartOutputDirectory();
@@ -121,7 +93,7 @@ void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
{
cmSystemTools::Error("Error Writing ", fname.c_str());
}
- this->WriteDSPFile(fout,lname,target, libOptions);
+ this->WriteDSPFile(fout,lname,target);
}
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
@@ -189,11 +161,10 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName,
- cmTarget &target,
- const std::string &libOptions)
+ cmTarget &target)
{
// Write the DSP file's header.
- this->WriteDSPHeader(fout, libName, libOptions);
+ this->WriteDSPHeader(fout, libName, target);
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
@@ -405,8 +376,55 @@ void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
}
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
- const std::string &libOptions)
+ const cmTarget &target)
{
+ // determine the link directories
+ std::string libOptions;
+ std::string libDebugOptions;
+ std::string libOptimizedOptions;
+ std::vector<std::string>::iterator i;
+ std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
+ for(i = libdirs.begin(); i != libdirs.end(); ++i)
+ {
+ libOptions += " /LIBPATH:\"";
+ libOptions += *i;
+ libOptions += "/$(OUTDIR)\" ";
+ libOptions += " /LIBPATH:\"";
+ libOptions += *i;
+ libOptions += "\" ";
+ }
+ // find link libraries
+ cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
+ cmMakefile::LinkLibraries::const_iterator j;
+ for(j = libs.begin(); j != libs.end(); ++j)
+ {
+ // add libraries to executables and dlls (but never include
+ // a library in a library, bad recursion)
+ if (!target.IsALibrary() ||
+ (m_LibraryBuildType == DLL && libName != j->first))
+ {
+ if (j->second == cmMakefile::GENERAL)
+ {
+ libOptions += " ";
+ libOptions += j->first;
+ libOptions += ".lib ";
+ }
+ if (j->second == cmMakefile::DEBUG)
+ {
+ libDebugOptions += " ";
+ libDebugOptions += j->first;
+ libDebugOptions += ".lib ";
+ }
+ if (j->second == cmMakefile::OPTIMIZED)
+ {
+ libOptimizedOptions += " ";
+ libOptimizedOptions += j->first;
+ libOptimizedOptions += ".lib ";
+ }
+ }
+ }
+ libOptions += "/STACK:10000000 ";
+
std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin)
{
@@ -420,6 +438,10 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
libOptions.c_str());
+ cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
+ libDebugOptions.c_str());
+ cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
+ libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
diff --git a/Source/cmDSPMakefile.h b/Source/cmDSPMakefile.h
index d231d16..c356653 100644
--- a/Source/cmDSPMakefile.h
+++ b/Source/cmDSPMakefile.h
@@ -67,16 +67,15 @@ private:
std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames;
- void CreateSingleDSP(const char *lname, cmTarget &tgt,
- const std::string &libs);
+ void CreateSingleDSP(const char *lname, cmTarget &tgt);
void WriteDSPFile(std::ostream& fout, const char *libName,
- cmTarget &tgt, const std::string &libs);
+ cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout,
const char* group,
const char* filter);
void WriteDSPEndGroup(std::ostream& fout);
void WriteDSPHeader(std::ostream& fout, const char *libName,
- const std::string &libs);
+ const cmTarget &tgt);
void WriteDSPBuildRule(std::ostream& fout, const char*);
void WriteDSPBuildRule(std::ostream& fout);
void WriteDSPFooter(std::ostream& fout);
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx
index 22dc798..1efbcc8 100644
--- a/Source/cmDSPWriter.cxx
+++ b/Source/cmDSPWriter.cxx
@@ -53,10 +53,8 @@ void cmDSPMakefile::OutputDSPFile()
}
// Create the DSP or set of DSP's for libraries and executables
- const char* cacheValue
- = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
m_LibraryBuildType = STATIC_LIBRARY;
- if(cacheValue && strcmp(cacheValue,"0"))
+ if(cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"))
{
m_LibraryBuildType = DLL;
}
@@ -69,30 +67,6 @@ void cmDSPMakefile::OutputDSPFile()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
- std::string libOptions;
- std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
- for(i = libdirs.begin(); i != libdirs.end(); ++i)
- {
- libOptions += " /LIBPATH:\"";
- libOptions += *i;
- libOptions += "/$(OUTDIR)\" ";
- libOptions += " /LIBPATH:\"";
- libOptions += *i;
- libOptions += "\" ";
- }
- std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
- for(i = libs.begin(); i != libs.end(); ++i)
- {
- // add libraries to executables and dlls (but never include
- // a library in a library, bad recursion)
- if (!l->second.IsALibrary() ||
- (m_LibraryBuildType == DLL && l->first.c_str() != *i))
- {
- libOptions += " ";
- libOptions += *i;
- libOptions += ".lib ";
- }
- }
if (l->second.IsALibrary())
{
this->SetBuildType(m_LibraryBuildType, l->first.c_str());
@@ -101,13 +75,11 @@ void cmDSPMakefile::OutputDSPFile()
{
this->SetBuildType(EXECUTABLE,l->first.c_str());
}
- libOptions += "/STACK:10000000 ";
- this->CreateSingleDSP(l->first.c_str(),l->second, libOptions);
+ this->CreateSingleDSP(l->first.c_str(),l->second);
}
}
-void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
- const std::string &libOptions)
+void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
{
std::string fname;
fname = m_Makefile->GetStartOutputDirectory();
@@ -121,7 +93,7 @@ void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
{
cmSystemTools::Error("Error Writing ", fname.c_str());
}
- this->WriteDSPFile(fout,lname,target, libOptions);
+ this->WriteDSPFile(fout,lname,target);
}
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
@@ -189,11 +161,10 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName,
- cmTarget &target,
- const std::string &libOptions)
+ cmTarget &target)
{
// Write the DSP file's header.
- this->WriteDSPHeader(fout, libName, libOptions);
+ this->WriteDSPHeader(fout, libName, target);
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
@@ -405,8 +376,55 @@ void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
}
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
- const std::string &libOptions)
+ const cmTarget &target)
{
+ // determine the link directories
+ std::string libOptions;
+ std::string libDebugOptions;
+ std::string libOptimizedOptions;
+ std::vector<std::string>::iterator i;
+ std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
+ for(i = libdirs.begin(); i != libdirs.end(); ++i)
+ {
+ libOptions += " /LIBPATH:\"";
+ libOptions += *i;
+ libOptions += "/$(OUTDIR)\" ";
+ libOptions += " /LIBPATH:\"";
+ libOptions += *i;
+ libOptions += "\" ";
+ }
+ // find link libraries
+ cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
+ cmMakefile::LinkLibraries::const_iterator j;
+ for(j = libs.begin(); j != libs.end(); ++j)
+ {
+ // add libraries to executables and dlls (but never include
+ // a library in a library, bad recursion)
+ if (!target.IsALibrary() ||
+ (m_LibraryBuildType == DLL && libName != j->first))
+ {
+ if (j->second == cmMakefile::GENERAL)
+ {
+ libOptions += " ";
+ libOptions += j->first;
+ libOptions += ".lib ";
+ }
+ if (j->second == cmMakefile::DEBUG)
+ {
+ libDebugOptions += " ";
+ libDebugOptions += j->first;
+ libDebugOptions += ".lib ";
+ }
+ if (j->second == cmMakefile::OPTIMIZED)
+ {
+ libOptimizedOptions += " ";
+ libOptimizedOptions += j->first;
+ libOptimizedOptions += ".lib ";
+ }
+ }
+ }
+ libOptions += "/STACK:10000000 ";
+
std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin)
{
@@ -420,6 +438,10 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
libOptions.c_str());
+ cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
+ libDebugOptions.c_str());
+ cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
+ libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
diff --git a/Source/cmDSPWriter.h b/Source/cmDSPWriter.h
index d231d16..c356653 100644
--- a/Source/cmDSPWriter.h
+++ b/Source/cmDSPWriter.h
@@ -67,16 +67,15 @@ private:
std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames;
- void CreateSingleDSP(const char *lname, cmTarget &tgt,
- const std::string &libs);
+ void CreateSingleDSP(const char *lname, cmTarget &tgt);
void WriteDSPFile(std::ostream& fout, const char *libName,
- cmTarget &tgt, const std::string &libs);
+ cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout,
const char* group,
const char* filter);
void WriteDSPEndGroup(std::ostream& fout);
void WriteDSPHeader(std::ostream& fout, const char *libName,
- const std::string &libs);
+ const cmTarget &tgt);
void WriteDSPBuildRule(std::ostream& fout, const char*);
void WriteDSPBuildRule(std::ostream& fout);
void WriteDSPFooter(std::ostream& fout);
diff --git a/Source/cmDSWMakefile.cxx b/Source/cmDSWMakefile.cxx
index 97eb9c3..8d00d9f 100644
--- a/Source/cmDSWMakefile.cxx
+++ b/Source/cmDSWMakefile.cxx
@@ -126,23 +126,24 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "{{{\n";
// insert Begin Project Dependency Project_Dep_Name project stuff here
- std::vector<std::string>::iterator i, end;
- i = project->GetMakefile()->GetLinkLibraries().begin();
- end = project->GetMakefile()->GetLinkLibraries().end();
- for(;i!= end; ++i)
+ cmMakefile::LinkLibraries::const_iterator j, jend;
+ j = project->GetMakefile()->GetLinkLibraries().begin();
+ jend = project->GetMakefile()->GetLinkLibraries().end();
+ for(;j!= jend; ++j)
{
- if(*i != dspname)
+ if(j->first != dspname)
{
if (!l.IsALibrary() ||
project->GetLibraryBuildType() == cmDSPMakefile::DLL)
{
fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << *i << "\n";
+ fout << "Project_Dep_Name " << j->first << "\n";
fout << "End Project Dependency\n";
}
}
}
-
+
+ std::vector<std::string>::iterator i, end;
// write utility dependencies.
i = project->GetMakefile()->GetUtilities().begin();
end = project->GetMakefile()->GetUtilities().end();
diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx
index 97eb9c3..8d00d9f 100644
--- a/Source/cmDSWWriter.cxx
+++ b/Source/cmDSWWriter.cxx
@@ -126,23 +126,24 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "{{{\n";
// insert Begin Project Dependency Project_Dep_Name project stuff here
- std::vector<std::string>::iterator i, end;
- i = project->GetMakefile()->GetLinkLibraries().begin();
- end = project->GetMakefile()->GetLinkLibraries().end();
- for(;i!= end; ++i)
+ cmMakefile::LinkLibraries::const_iterator j, jend;
+ j = project->GetMakefile()->GetLinkLibraries().begin();
+ jend = project->GetMakefile()->GetLinkLibraries().end();
+ for(;j!= jend; ++j)
{
- if(*i != dspname)
+ if(j->first != dspname)
{
if (!l.IsALibrary() ||
project->GetLibraryBuildType() == cmDSPMakefile::DLL)
{
fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << *i << "\n";
+ fout << "Project_Dep_Name " << j->first << "\n";
fout << "End Project Dependency\n";
}
}
}
-
+
+ std::vector<std::string>::iterator i, end;
// write utility dependencies.
i = project->GetMakefile()->GetUtilities().begin();
end = project->GetMakefile()->GetUtilities().end();
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index 4215147..e06fce8 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -23,10 +23,27 @@ bool cmLinkLibrariesCommand::Invoke(std::vector<std::string>& args)
this->SetError("called with incorrect number of arguments");
return false;
}
+ // add libraries, nothe that there is an optional prefix
+ // of debug and optimized than can be used
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
- m_Makefile->AddLinkLibrary((*i).c_str());
+ if (*i == "debug")
+ {
+ ++i;
+ m_Makefile->AddLinkLibrary(i->c_str(),
+ cmMakefile::DEBUG);
+ }
+ else if (*i == "optimized")
+ {
+ ++i;
+ m_Makefile->AddLinkLibrary(i->c_str(),
+ cmMakefile::OPTIMIZED);
+ }
+ else
+ {
+ m_Makefile->AddLinkLibrary(i->c_str());
+ }
}
return true;
}
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 5f01d52..3ef25f6 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -70,11 +70,14 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "LINK_LIBRARIES(library1 library2)\n"
+ "LINK_LIBRARIES(library1 <debug | optimized> library2 ...)\n"
"Specify a list of libraries to be linked into\n"
"executables or shared objects. This command is passed\n"
"down to all other commands. The library name should be\n"
- "the same as the name used in the LIBRARY(library) command.";
+ "the same as the name used in the LIBRARY(library) command.\n"
+ "The debug and optimized strings may be used to indicate that\n"
+ "the next library listed is to be used only for that specific\n"
+ "type of build";
}
cmTypeMacro(cmLinkLibrariesCommand, cmCommand);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 6446f98..a9a182d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -127,7 +127,6 @@ void cmMakefile::Print() const
this->PrintStringVector("m_MakeVerbatim ", m_MakeVerbatim);
this->PrintStringVector("m_IncludeDirectories;", m_IncludeDirectories);
this->PrintStringVector("m_LinkDirectories", m_LinkDirectories);
- this->PrintStringVector("m_LinkLibraries", m_LinkLibraries);
this->PrintStringVector("m_Utilities", m_Utilities);
this->PrintStringVector("m_UtilityDirectories", m_UtilityDirectories);
}
@@ -335,9 +334,15 @@ void cmMakefile::AddUtilityDirectory(const char* dir)
m_UtilityDirectories.push_back(dir);
}
+void cmMakefile::AddLinkLibrary(const char* lib, LinkLibraryType llt)
+{
+ m_LinkLibraries.push_back(
+ std::pair<std::string, LinkLibraryType>(lib,llt));
+}
+
void cmMakefile::AddLinkLibrary(const char* lib)
{
- m_LinkLibraries.push_back(lib);
+ this->AddLinkLibrary(lib,GENERAL);
}
void cmMakefile::AddLinkDirectory(const char* dir)
@@ -483,11 +488,12 @@ void cmMakefile::ExpandVariables()
{
this->ExpandVariablesInString(*j);
}
- begin = m_LinkLibraries.begin();
- end = m_LinkLibraries.end();
- for(j = begin; j != end; ++j)
+ LinkLibraries::iterator j2, end2;
+ j2 = m_LinkLibraries.begin();
+ end2 = m_LinkLibraries.end();
+ for(; j2 != end2; ++j2)
{
- this->ExpandVariablesInString(*j);
+ this->ExpandVariablesInString(j2->first);
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a8930b0..4da8f2b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -119,9 +119,20 @@ public:
void AddUtilityDirectory(const char*);
/**
+ * Get a list of link libraries in the build.
+ */
+ enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
+ typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
+ LinkLibraries& GetLinkLibraries()
+ {
+ return m_LinkLibraries;
+ }
+
+ /**
* Add a link library to the build.
*/
void AddLinkLibrary(const char*);
+ void AddLinkLibrary(const char*, LinkLibraryType type);
/**
* Add a link directory to the build.
@@ -333,14 +344,6 @@ public:
}
/**
- * Get a list of link libraries in the build.
- */
- std::vector<std::string>& GetLinkLibraries()
- {
- return m_LinkLibraries;
- }
-
- /**
* Return a list of source files in this makefile.
*/
typedef std::map<std::string,std::vector<cmSourceFile> > SourceMap;
@@ -446,7 +449,7 @@ protected:
std::vector<std::string> m_LinkDirectories;
std::vector<std::string> m_Utilities;
std::vector<std::string> m_UtilityDirectories;
- std::vector<std::string> m_LinkLibraries;
+ LinkLibraries m_LinkLibraries;
std::string m_IncludeFileRegularExpression;
std::string m_DefineFlags;
std::vector<cmSourceGroup> m_SourceGroups;
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 08392f2..c2da913 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -133,18 +133,21 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
linkLibs += " ";
}
std::string librariesLinked;
- std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
- for(j = libs.begin(); j != libs.end(); ++j)
+ cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
+ cmMakefile::LinkLibraries::const_iterator j2;
+ for(j2 = libs.begin(); j2 != libs.end(); ++j2)
{
// Don't link the library against itself!
- if(targetLibrary && (*j == targetLibrary)) continue;
- std::string::size_type pos = (*j).find("-l");
+ if(targetLibrary && (j2->first == targetLibrary)) continue;
+ // don't look at debug libraries
+ if (j2->second == cmMakefile::DEBUG) continue;
+ std::string::size_type pos = j2->first.find("-l");
if((pos == std::string::npos || pos > 0)
- && (*j).find("${") == std::string::npos)
+ && j2->first.find("${") == std::string::npos)
{
librariesLinked += "-l";
}
- librariesLinked += *j;
+ librariesLinked += j2->first;
librariesLinked += " ";
}
linkLibs += librariesLinked;
@@ -206,22 +209,22 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
{
fout << "CMAKE_DEPEND_LIBS = ";
- std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
- std::vector<std::string>::iterator dir, lib;
+ cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
+ cmMakefile::LinkLibraries::const_iterator lib2;
// Search the list of libraries that will be linked into
// the executable
- for(lib = libs.begin(); lib != libs.end(); ++lib)
+ for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2)
{
// loop over the list of directories that the libraries might
// be in, looking for an ADD_LIBRARY(lib...) line. This would
// be stored in the cache
const char* cacheValue
- = cmCacheManager::GetInstance()->GetCacheValue(lib->c_str());
+ = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
if(cacheValue)
{
std::string libpath = cacheValue;
libpath += "/lib";
- libpath += *lib;
+ libpath += lib2->first;
libpath += "${CMAKE_LIB_EXT}";
fout << libpath << " ";
}
@@ -229,7 +232,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
std::vector<std::string>& utils = m_Makefile->GetUtilities();
std::vector<std::string>& utildirs = m_Makefile->GetUtilityDirectories();
- std::vector<std::string>::iterator util;
+ std::vector<std::string>::iterator dir, util;
// Search the list of utilities that may be used to generate code for
// this project.
for(util = utils.begin(); util != utils.end(); ++util)
diff --git a/Source/cmVTKWrapPythonCommand.cxx b/Source/cmVTKWrapPythonCommand.cxx
index 0a26f8de..729375a 100644
--- a/Source/cmVTKWrapPythonCommand.cxx
+++ b/Source/cmVTKWrapPythonCommand.cxx
@@ -26,9 +26,7 @@ bool cmVTKWrapPythonCommand::Invoke(std::vector<std::string>& args)
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
- const char* cacheValue
- = cmCacheManager::GetInstance()->GetCacheValue("VTK_WRAP_PYTHON");
- if(!cacheValue || !strcmp(cacheValue,"0"))
+ if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_PYTHON"))
{
return true;
}