VS: Factor MS-tool-specific vcxproj settings into helper

Factor a WriteMSToolConfigurationValues helper method out of the
cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues method
to isolate the configuration settings specific to MS tools.
This commit is contained in:
Brad King 2014-06-05 14:57:23 -04:00
parent 808f4b1fa4
commit 1edaef39f1
2 changed files with 54 additions and 46 deletions

View File

@ -467,8 +467,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
@ -503,6 +501,18 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
this->WriteMSToolConfigurationValues(*i);
this->WriteString("</PropertyGroup>\n", 1);
}
}
//----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator
::WriteMSToolConfigurationValues(std::string const& config)
{
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
const char* mfcFlag =
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
@ -521,13 +531,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
this->WriteString(mfcLine.c_str(), 2);
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
this->ClOptions[config]->UsingUnicode()) ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
this->ClOptions[*i]->UsingSBCS())
this->ClOptions[config]->UsingSBCS())
{
this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
}
@ -547,9 +557,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
}
this->WriteString("</PropertyGroup>\n", 1);
}
}
void cmVisualStudio10TargetGenerator::WriteCustomCommands()

View File

@ -56,6 +56,7 @@ private:
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteMSToolConfigurationValues(std::string const& config);
void WriteSource(const char* tool, cmSourceFile const* sf,
const char* end = 0);
void WriteSources(const char* tool,