diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36815153b..42efec278 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -79,15 +79,22 @@ cmGlobalGenerator::~cmGlobalGenerator() bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { - cmOStringStream e; - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not support toolset specification, but toolset\n" - " " << ts << "\n" - "was specified."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; + if(ts.empty()) + { + return true; + } + else + { + cmOStringStream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support toolset specification, but toolset\n" + " " << ts << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } } std::string cmGlobalGenerator::SelectMakeProgram( @@ -454,8 +461,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // Tell the generator about the toolset, if any. std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); - if(!toolset.empty() && - !this->SetGeneratorToolset(toolset, mf)) + if(!this->SetGeneratorToolset(toolset, mf)) { cmSystemTools::SetFatalErrorOccured(); return; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 19aa52c88..63c32f947 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -121,7 +121,10 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { this->GeneratorToolset = ts; - this->AddVSPlatformToolsetDefinition(mf); + if(const char* toolset = this->GetPlatformToolset()) + { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); + } return true; } @@ -142,7 +145,6 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, return false; } } - this->AddVSPlatformToolsetDefinition(mf); return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf); } @@ -186,16 +188,6 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) return false; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator -::AddVSPlatformToolsetDefinition(cmMakefile* mf) const -{ - if(const char* toolset = this->GetPlatformToolset()) - { - mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); - } -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 11fa95458..f05b1748a 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -140,6 +140,5 @@ private: virtual std::string FindMSBuildCommand(); virtual std::string FindDevEnvCommand(); virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); } - void AddVSPlatformToolsetDefinition(cmMakefile* mf) const; }; #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 17f838c7b..13e698858 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -208,8 +208,11 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, if(this->XcodeVersion >= 30) { this->GeneratorToolset = ts; - mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->GeneratorToolset.c_str()); + if(!this->GeneratorToolset.empty()) + { + mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", + this->GeneratorToolset.c_str()); + } return true; } else