VS: Simplify setting of flag table.

This commit is contained in:
Stephen Kelly 2015-05-17 11:33:04 +02:00 committed by Brad King
parent fa85829712
commit b5f093f096
7 changed files with 32 additions and 41 deletions

View File

@ -31,7 +31,6 @@ cmGlobalVisualStudio71Generator::CreateLocalGenerator(cmLocalGenerator* parent)
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS71,
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
return lg;
}

View File

@ -18,6 +18,32 @@
#include "cmake.h"
#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS7ExtraFlagTable[] =
{
// Precompiled header and related options. Note that the
// UsePrecompiledHeader entries are marked as "Continue" so that the
// corresponding PrecompiledHeaderThrough entry can be found.
{"UsePrecompiledHeader", "YX", "Automatically Generate", "2",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
cmVS7FlagTable::UserValueRequired},
{"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
cmVS7FlagTable::UserValueRequired},
{"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true", 0},
// Exception handling mode. If no entries match, it will be FALSE.
{"ExceptionHandling", "GX", "enable c++ exceptions", "true", 0},
{"ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0},
// The EHa option does not have an IDE setting. Let it go to false,
// and have EHa passed on the command line by leaving out the table
// entry.
{0,0,0,0,0}
};
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
const std::string& platformName)
{
@ -33,6 +59,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
{
this->DefaultPlatformName = platformName;
}
this->ExtraFlagTable = cmVS7ExtraFlagTable;
}
cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator()
@ -256,7 +283,6 @@ cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS7,
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
return lg;
}
@ -1086,36 +1112,6 @@ cmGlobalVisualStudio7Generator
return false;
}
//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS7ExtraFlagTable[] =
{
// Precompiled header and related options. Note that the
// UsePrecompiledHeader entries are marked as "Continue" so that the
// corresponding PrecompiledHeaderThrough entry can be found.
{"UsePrecompiledHeader", "YX", "Automatically Generate", "2",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
cmVS7FlagTable::UserValueRequired},
{"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
cmVS7FlagTable::UserValueRequired},
{"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true", 0},
// Exception handling mode. If no entries match, it will be FALSE.
{"ExceptionHandling", "GX", "enable c++ exceptions", "true", 0},
{"ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0},
// The EHa option does not have an IDE setting. Let it go to false,
// and have EHa passed on the command line by leaving out the table
// entry.
{0,0,0,0,0}
};
cmIDEFlagTable const* cmGlobalVisualStudio7Generator::GetExtraFlagTableVS7()
{
return cmVS7ExtraFlagTable;
}
std::string cmGlobalVisualStudio7Generator::Encoding()
{
std::ostringstream encoding;

View File

@ -111,6 +111,8 @@ public:
// Encoding for Visual Studio files
virtual std::string Encoding();
cmIDEFlagTable const* ExtraFlagTable;
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "7.0"; }
@ -120,7 +122,6 @@ protected:
static const char* ExternalProjectType(const char* location);
static cmIDEFlagTable const* GetExtraFlagTableVS7();
virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,

View File

@ -101,6 +101,7 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
{
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name;
this->ExtraFlagTable = this->GetExtraFlagTableVS8();
}
//----------------------------------------------------------------------------
@ -131,7 +132,6 @@ cmGlobalVisualStudio8Generator::CreateLocalGenerator(cmLocalGenerator* parent)
cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8,
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
return lg;
}

View File

@ -120,7 +120,6 @@ cmGlobalVisualStudio9Generator::CreateLocalGenerator(cmLocalGenerator* parent)
cmLocalVisualStudio7Generator *lg
= new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9,
this, parent);
lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
return lg;
}

View File

@ -59,7 +59,6 @@ cmLocalVisualStudio7Generator
cmLocalGenerator* parent):
cmLocalVisualStudioGenerator(v, gg, parent)
{
this->ExtraFlagTable = 0;
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
}
@ -773,7 +772,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
Options targetOptions(this, t,
table,
this->ExtraFlagTable);
gg->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
std::string asmLocation = configName + "/";
targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
@ -1842,7 +1841,7 @@ bool cmLocalVisualStudio7Generator
table = cmLocalVisualStudio7GeneratorFortranFlagTable;
}
Options fileOptions(this, tool, table,
this->ExtraFlagTable);
gg->ExtraFlagTable);
fileOptions.Parse(fc.CompileFlags.c_str());
fileOptions.AddDefines(fc.CompileDefs.c_str());
fileOptions.AddDefines(fc.CompileDefsConfig.c_str());

View File

@ -54,8 +54,6 @@ public:
*/
void SetBuildType(BuildType,const std::string& name);
void SetExtraFlagTable(cmVS7FlagTable const* table)
{ this->ExtraFlagTable = table; }
virtual std::string GetTargetDirectory(cmTarget const&) const;
cmSourceFile* CreateVCProjBuildRule();
void WriteStampFiles();
@ -119,7 +117,6 @@ private:
class EventWriter;
friend class EventWriter;
cmVS7FlagTable const* ExtraFlagTable;
std::string ModuleDefinitionFile;
bool FortranProject;
bool WindowsCEProject;