Attached Files | cmLocalVisualStudio7Generator.cxx [^] (52,521 bytes) 1969-12-31 19:00
pch.diff [^] (11,414 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Source/cmLocalVisualStudio7Generator.cxx
===================================================================
--- Source/cmLocalVisualStudio7Generator.cxx (revision 154)
+++ Source/cmLocalVisualStudio7Generator.cxx (working copy)
@@ -320,12 +320,12 @@
{"InlineFunctionExpansion", "Ob0", "no inlines", "0"},
{"InlineFunctionExpansion", "Ob1", "when inline keyword", "1"},
{"InlineFunctionExpansion", "Ob2", "any time you can inline", "2"},
- {"RuntimeLibrary", "MTd", "Multithreded debug", "1"},
- {"RuntimeLibrary", "MT", "Multithreded", "0"},
- {"RuntimeLibrary", "MDd", "Multithreded dll debug", "3"},
- {"RuntimeLibrary", "MD", "Multithreded dll", "2"},
- {"RuntimeLibrary", "MLd", "Sinble Thread debug", "5"},
- {"RuntimeLibrary", "ML", "Sinble Thread", "4"},
+ {"RuntimeLibrary", "MTd", "Multithreaded debug", "1"},
+ {"RuntimeLibrary", "MT", "Multithreaded", "0"},
+ {"RuntimeLibrary", "MDd", "Multithreaded DLL debug", "3"},
+ {"RuntimeLibrary", "MD", "Multithreaded DLL", "2"},
+ {"RuntimeLibrary", "MLd", "Single Thread debug", "5"},
+ {"RuntimeLibrary", "ML", "Single Thread", "4"},
{"StructMemberAlignment", "Zp16", "struct align 16 byte ", "5"},
{"StructMemberAlignment", "Zp1", "struct align 1 byte ", "1"},
{"StructMemberAlignment", "Zp2", "struct align 2 byte ", "2"},
@@ -335,6 +335,8 @@
{"WarningLevel", "W2", "Warning level", "2"},
{"WarningLevel", "W3", "Warning level", "3"},
{"WarningLevel", "W4", "Warning level", "4"},
+ {"UsePrecompiledHeader", "Yc", "Create Precompiled Header", "1"},
+ {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2"},
// boolean flags
{"BufferSecurityCheck", "GS", "Buffer security check", "TRUE"},
@@ -355,6 +357,7 @@
{"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE"},
{"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE"},
{"WarnAsError", "WX", "Treat warnings as errors", "TRUE"},
+ {"PrecompiledHeaderFile", "Fp", "Precompiled Header File", ""},
{0,0,0,0 }
};
@@ -388,11 +391,11 @@
// Then parse the command line flags specified in CMAKE_CXX_FLAGS
// and CMAKE_C_FLAGS
// and overwrite or add new values to this map
- std::map<cmStdString, cmStdString> flagMap;
+ std::map<cmStdString, std::pair<cmStdString, cmStdString> > flagMap;
// since the default is on for this, but if /EHsc is found
// in the flags it will be turned on and we have /EHSC on by
// default in the CXX flags, then this is the only way to turn this off
- flagMap["ExceptionHandling"] = "FALSE";
+ flagMap["ExceptionHandling"] = std::pair<cmStdString, cmStdString>("FALSE", "");
const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if(!mfcFlag)
{
@@ -525,19 +528,19 @@
// set a few cmake specific flags
if(this->Makefile->IsOn("CMAKE_CXX_USE_RTTI"))
{
- flagMap["RuntimeTypeInfo"] = "TRUE";
+ flagMap["RuntimeTypeInfo"] = std::pair<cmStdString, cmStdString>("TRUE", "");
}
if ( this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") )
{
- flagMap["WarningLevel"] =
- this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL");
+ flagMap["WarningLevel"] = std::pair<cmStdString, cmStdString>(
+ this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL"), "");
}
// Now copy the flag map into the xml for the file
- for(std::map<cmStdString, cmStdString>::iterator m = flagMap.begin();
+ for(std::map<cmStdString, std::pair<cmStdString, cmStdString> >::iterator m = flagMap.begin();
m != flagMap.end(); ++m)
{
- fout << "\t\t\t\t" << m->first << "=\"" << m->second << "\"\n";
+ fout << "\t\t\t\t" << m->first << "=\"" << m->second.first << "\"\n";
}
fout << "\t\t\t\tPreprocessorDefinitions=\"";
if(target.GetType() == cmTarget::SHARED_LIBRARY
@@ -561,9 +564,9 @@
fout << "\"\n";
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
- std::map<cmStdString, cmStdString>::iterator mi =
+ std::map<cmStdString, std::pair<cmStdString, cmStdString> >::iterator mi =
flagMap.find("DebugInformationFormat");
- if(mi != flagMap.end() && mi->second != "1")
+ if(mi != flagMap.end() && mi->second.first != "1")
{
fout << "\t\t\t\tProgramDataBaseFileName=\""
<< this->LibraryOutputPath
@@ -627,7 +630,7 @@
}
void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags(
- std::map<cmStdString, cmStdString>& flagMap,
+ std::map<cmStdString, std::pair<cmStdString, cmStdString> >& flagMap,
cmVS7FlagTable* flagTable,
std::string& flags)
{
@@ -639,21 +642,35 @@
// first do the - version
option = "-";
option += flagTable->commandFlag;
- while(flags.find(option) != flags.npos)
+ for(size_t flagPos = flags.find(option); flagPos!=flags.npos; flagPos=flags.find(option))
{
+ // get flag value
+ size_t flagValuePos = flagPos + option.length();
+ size_t flagEndPos = flags.find(" ", flagValuePos);
+ if(flagEndPos == flags.npos)
+ flagEndPos = flags.length();
+ cmStdString flagValue;
+ std::copy(flags.begin()+flagValuePos, flags.begin()+flagEndPos, std::back_insert_iterator<cmStdString>(flagValue));
// replace the flag
- cmSystemTools::ReplaceString(flags, option.c_str(), "");
+ cmSystemTools::ReplaceString(flags, (option+flagValue).c_str(), "");
// now put value into flag map
- flagMap[flagTable->IDEName] = flagTable->value;
+ flagMap[flagTable->IDEName] = std::pair<cmStdString, cmStdString>(flagTable->value, flagValue);
}
// now do the / version
option[0] = '/';
- while(flags.find(option) != flags.npos)
+ for(size_t flagPos = flags.find(option); flagPos!=flags.npos; flagPos=flags.find(option))
{
+ // get flag value
+ size_t flagValuePos = flagPos + option.length();
+ size_t flagEndPos = flags.find(" ", flagValuePos);
+ if(flagEndPos == flags.npos)
+ flagEndPos = flags.length();
+ cmStdString flagValue;
+ std::copy(flags.begin()+flagValuePos, flags.begin()+flagEndPos, std::back_insert_iterator<cmStdString>(flagValue));
// replace the flag
- cmSystemTools::ReplaceString(flags, option.c_str(), "");
+ cmSystemTools::ReplaceString(flags, (option+flagValue).c_str(), "");
// now put value into flag map
- flagMap[flagTable->IDEName] = flagTable->value;
+ flagMap[flagTable->IDEName] = std::make_pair<cmStdString, cmStdString>(flagTable->value, flagValue);
}
// move to next flag
flagTable++;
@@ -667,7 +684,7 @@
{
if(flagMap.find("SuppressStartupBanner") == flagMap.end())
{
- flagMap["SuppressStartupBanner"] = "FALSE";
+ flagMap["SuppressStartupBanner"] = std::pair<cmStdString, cmStdString>("FALSE", "");
}
}
}
@@ -733,7 +750,7 @@
extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags;
}
- std::map<cmStdString, cmStdString> flagMap;
+ std::map<cmStdString, std::pair<cmStdString, cmStdString> > flagMap;
this->FillFlagMapFromCommandFlags
(flagMap, &cmLocalVisualStudio7GeneratorLinkFlagTable[0],
extraLinkOptions);
@@ -802,10 +819,10 @@
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
- for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin();
+ for(std::map<cmStdString, std::pair<cmStdString, cmStdString> >::iterator i = flagMap.begin();
i != flagMap.end(); ++i)
{
- fout << "\t\t\t\t" << i->first << "=\"" << i->second << "\"\n";
+ fout << "\t\t\t\t" << i->first << "=\"" << i->second.first << "\"\n";
}
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
@@ -813,7 +830,7 @@
this->OutputModuleDefinitionFile(fout, target);
temp = this->LibraryOutputPath;
temp += "$(OutDir)/";
- temp += libName;
+ temp += target.GetFullName(configName);
temp += ".pdb";
fout << "\t\t\t\tProgramDataBaseFile=\"" <<
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
@@ -887,10 +904,10 @@
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
- for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin();
+ for(std::map<cmStdString, std::pair<cmStdString, cmStdString> >::iterator i = flagMap.begin();
i != flagMap.end(); ++i)
{
- fout << "\t\t\t\t" << i->first << "=\"" << i->second << "\"\n";
+ fout << "\t\t\t\t" << i->first << "=\"" << i->second.first << "\"\n";
}
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
@@ -1267,7 +1284,7 @@
if(compileFlags.size())
{
std::string compileFlagsCopy = compileFlags;
- std::map<cmStdString, cmStdString> fileFlagMap;
+ std::map<cmStdString, std::pair<cmStdString, cmStdString> > fileFlagMap;
this->FillFlagMapFromCommandFlags
(fileFlagMap,
&cmLocalVisualStudio7GeneratorFlagTable[0],
@@ -1280,11 +1297,28 @@
<< this->EscapeForXML(compileFlagsCopy.c_str()) << "\"\n";
}
for(std::map<cmStdString,
- cmStdString>::iterator m = fileFlagMap.begin();
+ std::pair<cmStdString, cmStdString> >::iterator m = fileFlagMap.begin();
m != fileFlagMap.end(); ++m)
{
- fout << "\t\t\t\t\t" << m->first << "=\""
- << m->second << "\"\n";
+ if(m->first == "PrecompiledHeaderFile")
+ {
+ fout << "\t\t\t\t\tPrecompiledHeaderFile=\""
+ << this->EscapeForXML(m->second.second.c_str())
+ << "\"\n";
+ }
+ else if(m->first == "UsePrecompiledHeader")
+ {
+ fout << "\t\t\t\t\tUsePrecompiledHeader=\""
+ << m->second.first << "\"\n";
+ fout << "\t\t\t\t\tPrecompiledHeaderThrough=\""
+ << this->EscapeForXML(m->second.second.c_str())
+ << "\"\n";
+ }
+ else
+ {
+ fout << "\t\t\t\t\t" << m->first << "=\""
+ << m->second.first << "\"\n";
+ }
}
}
if(additionalDeps.length())
Index: Source/cmLocalVisualStudio7Generator.h
===================================================================
--- Source/cmLocalVisualStudio7Generator.h (revision 154)
+++ Source/cmLocalVisualStudio7Generator.h (working copy)
@@ -66,7 +66,7 @@
virtual void ConfigureFinalPass();
private:
void FillFlagMapFromCommandFlags(std::map<cmStdString,
- cmStdString>& flagMap,
+ std::pair<cmStdString, cmStdString> >& flagMap,
cmVS7FlagTable* flagTable,
std::string& flags);
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
|