VS: Make MS-tool-specific options conditional
Make blocks adding MS-tool-specific options conditional on a new "MSTools" boolean member of cmVisualStudio10TargetGenerator. Hard-code the member to true for now to preserve existing behavior.
This commit is contained in:
parent
e4510941a3
commit
7a9909db86
|
@ -41,58 +41,74 @@
|
||||||
|
|
||||||
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
|
||||||
{
|
{
|
||||||
cmLocalVisualStudioGenerator::VSVersion
|
if(this->MSTools)
|
||||||
v = this->LocalGenerator->GetVersion();
|
{
|
||||||
if(v >= cmLocalVisualStudioGenerator::VS14)
|
cmLocalVisualStudioGenerator::VSVersion
|
||||||
{ return cmVS14CLFlagTable; }
|
v = this->LocalGenerator->GetVersion();
|
||||||
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
||||||
{ return cmVS12CLFlagTable; }
|
{ return cmVS14CLFlagTable; }
|
||||||
else if(v == cmLocalVisualStudioGenerator::VS11)
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
||||||
{ return cmVS11CLFlagTable; }
|
{ return cmVS12CLFlagTable; }
|
||||||
else
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
||||||
{ return cmVS10CLFlagTable; }
|
{ return cmVS11CLFlagTable; }
|
||||||
|
else
|
||||||
|
{ return cmVS10CLFlagTable; }
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
|
||||||
{
|
{
|
||||||
cmLocalVisualStudioGenerator::VSVersion
|
if(this->MSTools)
|
||||||
v = this->LocalGenerator->GetVersion();
|
{
|
||||||
if(v >= cmLocalVisualStudioGenerator::VS14)
|
cmLocalVisualStudioGenerator::VSVersion
|
||||||
{ return cmVS14RCFlagTable; }
|
v = this->LocalGenerator->GetVersion();
|
||||||
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
||||||
{ return cmVS12RCFlagTable; }
|
{ return cmVS14RCFlagTable; }
|
||||||
else if(v == cmLocalVisualStudioGenerator::VS11)
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
||||||
{ return cmVS11RCFlagTable; }
|
{ return cmVS12RCFlagTable; }
|
||||||
else
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
||||||
{ return cmVS10RCFlagTable; }
|
{ return cmVS11RCFlagTable; }
|
||||||
|
else
|
||||||
|
{ return cmVS10RCFlagTable; }
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
|
||||||
{
|
{
|
||||||
cmLocalVisualStudioGenerator::VSVersion
|
if(this->MSTools)
|
||||||
v = this->LocalGenerator->GetVersion();
|
{
|
||||||
if(v >= cmLocalVisualStudioGenerator::VS14)
|
cmLocalVisualStudioGenerator::VSVersion
|
||||||
{ return cmVS14LibFlagTable; }
|
v = this->LocalGenerator->GetVersion();
|
||||||
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
||||||
{ return cmVS12LibFlagTable; }
|
{ return cmVS14LibFlagTable; }
|
||||||
else if(v == cmLocalVisualStudioGenerator::VS11)
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
||||||
{ return cmVS11LibFlagTable; }
|
{ return cmVS12LibFlagTable; }
|
||||||
else
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
||||||
{ return cmVS10LibFlagTable; }
|
{ return cmVS11LibFlagTable; }
|
||||||
|
else
|
||||||
|
{ return cmVS10LibFlagTable; }
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
|
||||||
{
|
{
|
||||||
cmLocalVisualStudioGenerator::VSVersion
|
if(this->MSTools)
|
||||||
v = this->LocalGenerator->GetVersion();
|
{
|
||||||
if(v >= cmLocalVisualStudioGenerator::VS14)
|
cmLocalVisualStudioGenerator::VSVersion
|
||||||
{ return cmVS14LinkFlagTable; }
|
v = this->LocalGenerator->GetVersion();
|
||||||
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
||||||
{ return cmVS12LinkFlagTable; }
|
{ return cmVS14LinkFlagTable; }
|
||||||
else if(v == cmLocalVisualStudioGenerator::VS11)
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
||||||
{ return cmVS11LinkFlagTable; }
|
{ return cmVS12LinkFlagTable; }
|
||||||
else
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
||||||
{ return cmVS10LinkFlagTable; }
|
{ return cmVS11LinkFlagTable; }
|
||||||
|
else
|
||||||
|
{ return cmVS10LinkFlagTable; }
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string cmVS10EscapeXML(std::string arg)
|
static std::string cmVS10EscapeXML(std::string arg)
|
||||||
|
@ -142,6 +158,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
|
||||||
this->GlobalGenerator->CreateGUID(this->Name.c_str());
|
this->GlobalGenerator->CreateGUID(this->Name.c_str());
|
||||||
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
|
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
|
||||||
this->Platform = gg->GetPlatformName();
|
this->Platform = gg->GetPlatformName();
|
||||||
|
this->MSTools = true;
|
||||||
this->BuildFileStream = 0;
|
this->BuildFileStream = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +549,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||||
configType += "</ConfigurationType>\n";
|
configType += "</ConfigurationType>\n";
|
||||||
this->WriteString(configType.c_str(), 2);
|
this->WriteString(configType.c_str(), 2);
|
||||||
|
|
||||||
this->WriteMSToolConfigurationValues(*i);
|
if(this->MSTools)
|
||||||
|
{
|
||||||
|
this->WriteMSToolConfigurationValues(*i);
|
||||||
|
}
|
||||||
|
|
||||||
this->WriteString("</PropertyGroup>\n", 1);
|
this->WriteString("</PropertyGroup>\n", 1);
|
||||||
}
|
}
|
||||||
|
@ -1447,17 +1467,23 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
||||||
|
|
||||||
// Get preprocessor definitions for this directory.
|
// Get preprocessor definitions for this directory.
|
||||||
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
|
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
|
||||||
clOptions.FixExceptionHandlingDefault();
|
if(this->MSTools)
|
||||||
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
|
{
|
||||||
std::string asmLocation = configName + "/";
|
clOptions.FixExceptionHandlingDefault();
|
||||||
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
|
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
|
||||||
|
std::string asmLocation = configName + "/";
|
||||||
|
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
|
||||||
|
}
|
||||||
clOptions.Parse(flags.c_str());
|
clOptions.Parse(flags.c_str());
|
||||||
clOptions.Parse(defineFlags.c_str());
|
clOptions.Parse(defineFlags.c_str());
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
|
this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
|
||||||
clOptions.AddDefines(targetDefines);
|
clOptions.AddDefines(targetDefines);
|
||||||
clOptions.SetVerboseMakefile(
|
if(this->MSTools)
|
||||||
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
{
|
||||||
|
clOptions.SetVerboseMakefile(
|
||||||
|
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
||||||
|
}
|
||||||
|
|
||||||
// Add a definition for the configuration name.
|
// Add a definition for the configuration name.
|
||||||
std::string configDefine = "CMAKE_INTDIR=\"";
|
std::string configDefine = "CMAKE_INTDIR=\"";
|
||||||
|
@ -1486,24 +1512,27 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
|
||||||
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
||||||
"\n", "CXX");
|
"\n", "CXX");
|
||||||
|
|
||||||
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
|
if(this->MSTools)
|
||||||
|
|
||||||
// If not in debug mode, write the DebugInformationFormat field
|
|
||||||
// without value so PDBs don't get generated uselessly.
|
|
||||||
if(!clOptions.IsDebug())
|
|
||||||
{
|
{
|
||||||
this->WriteString("<DebugInformationFormat>"
|
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
|
||||||
"</DebugInformationFormat>\n", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specify the compiler program database file if configured.
|
// If not in debug mode, write the DebugInformationFormat field
|
||||||
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str());
|
// without value so PDBs don't get generated uselessly.
|
||||||
if(!pdb.empty())
|
if(!clOptions.IsDebug())
|
||||||
{
|
{
|
||||||
this->ConvertToWindowsSlash(pdb);
|
this->WriteString("<DebugInformationFormat>"
|
||||||
this->WriteString("<ProgramDataBaseFileName>", 3);
|
"</DebugInformationFormat>\n", 3);
|
||||||
*this->BuildFileStream << cmVS10EscapeXML(pdb)
|
}
|
||||||
<< "</ProgramDataBaseFileName>\n";
|
|
||||||
|
// Specify the compiler program database file if configured.
|
||||||
|
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str());
|
||||||
|
if(!pdb.empty())
|
||||||
|
{
|
||||||
|
this->ConvertToWindowsSlash(pdb);
|
||||||
|
this->WriteString("<ProgramDataBaseFileName>", 3);
|
||||||
|
*this->BuildFileStream << cmVS10EscapeXML(pdb)
|
||||||
|
<< "</ProgramDataBaseFileName>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->WriteString("</ClCompile>\n", 2);
|
this->WriteString("</ClCompile>\n", 2);
|
||||||
|
@ -1567,6 +1596,10 @@ void cmVisualStudio10TargetGenerator::
|
||||||
WriteRCOptions(std::string const& configName,
|
WriteRCOptions(std::string const& configName,
|
||||||
std::vector<std::string> const & includes)
|
std::vector<std::string> const & includes)
|
||||||
{
|
{
|
||||||
|
if(!this->MSTools)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->WriteString("<ResourceCompile>\n", 2);
|
this->WriteString("<ResourceCompile>\n", 2);
|
||||||
|
|
||||||
// Preprocessor definitions and includes are shared with clOptions.
|
// Preprocessor definitions and includes are shared with clOptions.
|
||||||
|
@ -1754,45 +1787,53 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
|
||||||
config.c_str());
|
config.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
linkOptions.AddFlag("Version", "");
|
if(this->MSTools)
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("Version", "");
|
||||||
|
|
||||||
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
|
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
|
||||||
{
|
{
|
||||||
linkOptions.AddFlag("SubSystem", "Windows");
|
linkOptions.AddFlag("SubSystem", "Windows");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
linkOptions.AddFlag("SubSystem", "Console");
|
linkOptions.AddFlag("SubSystem", "Console");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(const char* stackVal =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE"))
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("StackReserveSize", stackVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos)
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("GenerateDebugInformation", "true");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("GenerateDebugInformation", "false");
|
||||||
|
}
|
||||||
|
std::string pdb = this->Target->GetPDBDirectory(config.c_str());
|
||||||
|
pdb += "/";
|
||||||
|
pdb += targetNamePDB;
|
||||||
|
std::string imLib = this->Target->GetDirectory(config.c_str(), true);
|
||||||
|
imLib += "/";
|
||||||
|
imLib += targetNameImport;
|
||||||
|
|
||||||
|
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
|
||||||
|
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* stackVal =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE"))
|
|
||||||
{
|
|
||||||
linkOptions.AddFlag("StackReserveSize", stackVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos)
|
|
||||||
{
|
|
||||||
linkOptions.AddFlag("GenerateDebugInformation", "true");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
linkOptions.AddFlag("GenerateDebugInformation", "false");
|
|
||||||
}
|
|
||||||
std::string pdb = this->Target->GetPDBDirectory(config.c_str());
|
|
||||||
pdb += "/";
|
|
||||||
pdb += targetNamePDB;
|
|
||||||
std::string imLib = this->Target->GetDirectory(config.c_str(), true);
|
|
||||||
imLib += "/";
|
|
||||||
imLib += targetNameImport;
|
|
||||||
|
|
||||||
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
|
|
||||||
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
|
|
||||||
linkOptions.Parse(flags.c_str());
|
linkOptions.Parse(flags.c_str());
|
||||||
std::string def = this->GeneratorTarget->GetModuleDefinitionFile("");
|
|
||||||
if(!def.empty())
|
if(this->MSTools)
|
||||||
{
|
{
|
||||||
linkOptions.AddFlag("ModuleDefinitionFile", def.c_str());
|
std::string def = this->GeneratorTarget->GetModuleDefinitionFile("");
|
||||||
|
if(!def.empty())
|
||||||
|
{
|
||||||
|
linkOptions.AddFlag("ModuleDefinitionFile", def.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->LinkOptions[config] = pOptions.release();
|
this->LinkOptions[config] = pOptions.release();
|
||||||
|
@ -1857,6 +1898,11 @@ void cmVisualStudio10TargetGenerator::
|
||||||
WriteMidlOptions(std::string const& /*config*/,
|
WriteMidlOptions(std::string const& /*config*/,
|
||||||
std::vector<std::string> const & includes)
|
std::vector<std::string> const & includes)
|
||||||
{
|
{
|
||||||
|
if(!this->MSTools)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This processes *any* of the .idl files specified in the project's file
|
// This processes *any* of the .idl files specified in the project's file
|
||||||
// list (and passed as the item metadata %(Filename) expressing the rule
|
// list (and passed as the item metadata %(Filename) expressing the rule
|
||||||
// input filename) into output files at the per-config *build* dir
|
// input filename) into output files at the per-config *build* dir
|
||||||
|
|
|
@ -120,6 +120,7 @@ private:
|
||||||
std::string Platform;
|
std::string Platform;
|
||||||
std::string GUID;
|
std::string GUID;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
bool MSTools;
|
||||||
cmGlobalVisualStudio10Generator* GlobalGenerator;
|
cmGlobalVisualStudio10Generator* GlobalGenerator;
|
||||||
cmGeneratedFileStream* BuildFileStream;
|
cmGeneratedFileStream* BuildFileStream;
|
||||||
cmLocalVisualStudio7Generator* LocalGenerator;
|
cmLocalVisualStudio7Generator* LocalGenerator;
|
||||||
|
|
Loading…
Reference in New Issue