Merge topic 'vs-MSTool-condition'

7a9909db VS: Make MS-tool-specific options conditional
This commit is contained in:
Brad King 2014-07-18 10:56:59 -04:00 committed by CMake Topic Stage
commit 5a128c8ec9
2 changed files with 144 additions and 97 deletions

View File

@ -41,6 +41,8 @@
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
{
if(this->MSTools)
{
cmLocalVisualStudioGenerator::VSVersion
v = this->LocalGenerator->GetVersion();
if(v >= cmLocalVisualStudioGenerator::VS14)
@ -51,10 +53,14 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
{ return cmVS11CLFlagTable; }
else
{ return cmVS10CLFlagTable; }
}
return 0;
}
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
{
if(this->MSTools)
{
cmLocalVisualStudioGenerator::VSVersion
v = this->LocalGenerator->GetVersion();
if(v >= cmLocalVisualStudioGenerator::VS14)
@ -65,10 +71,14 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
{ return cmVS11RCFlagTable; }
else
{ return cmVS10RCFlagTable; }
}
return 0;
}
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
{
if(this->MSTools)
{
cmLocalVisualStudioGenerator::VSVersion
v = this->LocalGenerator->GetVersion();
if(v >= cmLocalVisualStudioGenerator::VS14)
@ -79,10 +89,14 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
{ return cmVS11LibFlagTable; }
else
{ return cmVS10LibFlagTable; }
}
return 0;
}
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
{
if(this->MSTools)
{
cmLocalVisualStudioGenerator::VSVersion
v = this->LocalGenerator->GetVersion();
if(v >= cmLocalVisualStudioGenerator::VS14)
@ -93,6 +107,8 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
{ return cmVS11LinkFlagTable; }
else
{ return cmVS10LinkFlagTable; }
}
return 0;
}
static std::string cmVS10EscapeXML(std::string arg)
@ -142,6 +158,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->GlobalGenerator->CreateGUID(this->Name.c_str());
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName();
this->MSTools = true;
this->BuildFileStream = 0;
}
@ -532,7 +549,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
if(this->MSTools)
{
this->WriteMSToolConfigurationValues(*i);
}
this->WriteString("</PropertyGroup>\n", 1);
}
@ -1447,17 +1467,23 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
if(this->MSTools)
{
clOptions.FixExceptionHandlingDefault();
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
std::string asmLocation = configName + "/";
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
}
clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str());
std::vector<std::string> targetDefines;
this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
clOptions.AddDefines(targetDefines);
if(this->MSTools)
{
clOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
}
// Add a definition for the configuration name.
std::string configDefine = "CMAKE_INTDIR=\"";
@ -1486,6 +1512,8 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
if(this->MSTools)
{
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
// If not in debug mode, write the DebugInformationFormat field
@ -1505,6 +1533,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
*this->BuildFileStream << cmVS10EscapeXML(pdb)
<< "</ProgramDataBaseFileName>\n";
}
}
this->WriteString("</ClCompile>\n", 2);
}
@ -1567,6 +1596,10 @@ void cmVisualStudio10TargetGenerator::
WriteRCOptions(std::string const& configName,
std::vector<std::string> const & includes)
{
if(!this->MSTools)
{
return;
}
this->WriteString("<ResourceCompile>\n", 2);
// Preprocessor definitions and includes are shared with clOptions.
@ -1754,6 +1787,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
config.c_str());
}
if(this->MSTools)
{
linkOptions.AddFlag("Version", "");
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
@ -1788,12 +1823,18 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
}
linkOptions.Parse(flags.c_str());
if(this->MSTools)
{
std::string def = this->GeneratorTarget->GetModuleDefinitionFile("");
if(!def.empty())
{
linkOptions.AddFlag("ModuleDefinitionFile", def.c_str());
}
}
this->LinkOptions[config] = pOptions.release();
return true;
@ -1857,6 +1898,11 @@ void cmVisualStudio10TargetGenerator::
WriteMidlOptions(std::string const& /*config*/,
std::vector<std::string> const & includes)
{
if(!this->MSTools)
{
return;
}
// This processes *any* of the .idl files specified in the project's file
// list (and passed as the item metadata %(Filename) expressing the rule
// input filename) into output files at the per-config *build* dir

View File

@ -120,6 +120,7 @@ private:
std::string Platform;
std::string GUID;
std::string Name;
bool MSTools;
cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator;