diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 06c0825bf..acf3930b5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -467,8 +467,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { - cmGlobalVisualStudio10Generator* gg = - static_cast(this->GlobalGenerator); std::vector *configs = static_cast (this->GlobalGenerator)->GetConfigurations(); @@ -503,55 +501,64 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "\n"; this->WriteString(configType.c_str(), 2); - const char* mfcFlag = - this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); - std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; - - std::string useOfMfcValue = "false"; - if(mfcFlagValue == "1") - { - useOfMfcValue = "Static"; - } - else if(mfcFlagValue == "2") - { - useOfMfcValue = "Dynamic"; - } - std::string mfcLine = ""; - mfcLine += useOfMfcValue + "\n"; - this->WriteString(mfcLine.c_str(), 2); - - if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && - this->ClOptions[*i]->UsingUnicode()) || - this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) - { - this->WriteString("Unicode\n", 2); - } - else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && - this->ClOptions[*i]->UsingSBCS()) - { - this->WriteString("NotSet\n", 2); - } - else - { - this->WriteString("MultiByte\n", 2); - } - if(const char* toolset = gg->GetPlatformToolset()) - { - std::string pts = ""; - pts += toolset; - pts += "\n"; - this->WriteString(pts.c_str(), 2); - } - if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) - { - this->WriteString("true" - "\n", 2); - } + this->WriteMSToolConfigurationValues(*i); this->WriteString("\n", 1); } } +//---------------------------------------------------------------------------- +void cmVisualStudio10TargetGenerator +::WriteMSToolConfigurationValues(std::string const& config) +{ + cmGlobalVisualStudio10Generator* gg = + static_cast(this->GlobalGenerator); + const char* mfcFlag = + this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); + std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; + + std::string useOfMfcValue = "false"; + if(mfcFlagValue == "1") + { + useOfMfcValue = "Static"; + } + else if(mfcFlagValue == "2") + { + useOfMfcValue = "Dynamic"; + } + std::string mfcLine = ""; + mfcLine += useOfMfcValue + "\n"; + this->WriteString(mfcLine.c_str(), 2); + + if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && + this->ClOptions[config]->UsingUnicode()) || + this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + { + this->WriteString("Unicode\n", 2); + } + else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + this->ClOptions[config]->UsingSBCS()) + { + this->WriteString("NotSet\n", 2); + } + else + { + this->WriteString("MultiByte\n", 2); + } + if(const char* toolset = gg->GetPlatformToolset()) + { + std::string pts = ""; + pts += toolset; + pts += "\n"; + this->WriteString(pts.c_str(), 2); + } + if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + { + this->WriteString("true" + "\n", 2); + } +} + void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 67a248875..8f2facaec 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -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,