BUG: fix crash with vs6

This commit is contained in:
Ken Martin 2004-09-24 11:35:16 -04:00
parent 1ffbc81061
commit e735351b3f
1 changed files with 27 additions and 24 deletions

View File

@ -342,7 +342,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
}
const char* lang =
m_GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str());
if(strcmp(lang, "CXX") == 0)
if(lang && strcmp(lang, "CXX") == 0)
{
// force a C++ file type
compileFlags += " /TP ";
@ -1057,10 +1057,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
std::string flagsMinSize = " ";
std::string flagsDebug = " ";
std::string flagsDebugRel = " ";
if(target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::MODULE_LIBRARY)
{
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
// if CXX is on and the target contains cxx code then add the cxx flags
std::string baseFlagVar = "CMAKE_";
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
baseFlagVar += "CMAKE_";
baseFlagVar += linkLanguage;
baseFlagVar += "_FLAGS";
flags = m_Makefile->GetRequiredDefinition(baseFlagVar.c_str());
@ -1080,6 +1082,7 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
flagVar = baseFlagVar + "_RELWITHDEBINFO";
flagsDebugRel = m_Makefile->GetRequiredDefinition(flagVar.c_str());
flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
}
// if unicode is not found, then add -D_MBCS
std::string defs = m_Makefile->GetDefineFlags();