diff options
author | Brad King <brad.king@kitware.com> | 2014-06-05 15:31:00 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-06-05 15:31:00 (GMT) |
commit | 88818b680549651b6531a6648396d749b759afb2 (patch) | |
tree | d647c967a515bf2601e13dafedc8ddf67b4e0c03 /Source | |
parent | 64f399322051c16ea1a81cde19d5eec0fb846ca9 (diff) | |
parent | 528e8af19f68c01c3a42af9e74801a39c16237dd (diff) | |
download | CMake-88818b680549651b6531a6648396d749b759afb2.zip CMake-88818b680549651b6531a6648396d749b759afb2.tar.gz CMake-88818b680549651b6531a6648396d749b759afb2.tar.bz2 |
Merge topic 'delay-generator-toolset'
528e8af1 Allow a toolchain file to specify a generator toolset
98afb454 VS: Split user- and generator-provided PlatformToolset
3e9f6e36 Xcode: Rename internal variable {Platform => Generator}Toolset
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 32 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 8 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio11Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio12Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 18 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmake.cxx | 5 |
9 files changed, 52 insertions, 36 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dba4f46..bb818eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -76,7 +76,8 @@ cmGlobalGenerator::~cmGlobalGenerator() } } -bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) +bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { cmOStringStream e; e << @@ -85,8 +86,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) "does not support toolset specification, but toolset\n" " " << ts << "\n" "was specified."; - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - cmListFileBacktrace()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -448,6 +448,15 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, mf->ReadListFile(0,fpath.c_str()); } + // Tell the generator about the toolset, if any. + std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); + if(!toolset.empty() && + !this->SetGeneratorToolset(toolset, mf)) + { + cmSystemTools::SetFatalErrorOccured(); + return; + } + // **** Load the system specific initialization if not yet loaded if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 617e708..67bd378 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -63,7 +63,7 @@ public: /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); /** * Create LocalGenerators and process the CMakeLists files. This does not diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 37a416b..86d0de3 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -116,9 +116,11 @@ cmGlobalVisualStudio10Generator::MatchesGeneratorName( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) +cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; + this->AddVSPlatformToolsetDefinition(mf); return true; } @@ -126,10 +128,16 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); - if(!this->PlatformToolset.empty()) + this->AddVSPlatformToolsetDefinition(mf); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Generator +::AddVSPlatformToolsetDefinition(cmMakefile* mf) const +{ + if(const char* toolset = this->GetPlatformToolset()) { - mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", - this->PlatformToolset.c_str()); + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); } } @@ -215,11 +223,15 @@ void cmGlobalVisualStudio10Generator } //---------------------------------------------------------------------------- -const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() +const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const { - if(!this->PlatformToolset.empty()) + if(!this->GeneratorToolset.empty()) + { + return this->GeneratorToolset.c_str(); + } + if(!this->DefaultPlatformToolset.empty()) { - return this->PlatformToolset.c_str(); + return this->DefaultPlatformToolset.c_str(); } return 0; } @@ -417,7 +429,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { - if(!this->PlatformToolset.empty()) + if(this->GetPlatformToolset()) { return true; } @@ -435,7 +447,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) cmOStringStream m; m << "Found Windows SDK v7.1: " << winSDK_7_1; mf->DisplayStatus(m.str().c_str(), -1); - this->PlatformToolset = "Windows7.1SDK"; + this->DefaultPlatformToolset = "Windows7.1SDK"; return true; } else diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index ede6b1b..b4dcc7e 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -31,7 +31,7 @@ public: virtual bool MatchesGeneratorName(const std::string& name) const; - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual void GenerateBuildCommand( std::vector<std::string>& makeCommand, @@ -66,7 +66,7 @@ public: bool IsMasmEnabled() const { return this->MasmEnabled; } /** The toolset name for the target platform. */ - const char* GetPlatformToolset(); + const char* GetPlatformToolset() const; /** * Where does this version of Visual Studio look for macros for the @@ -99,7 +99,8 @@ protected: std::string const& GetMSBuildCommand(); - std::string PlatformToolset; + std::string GeneratorToolset; + std::string DefaultPlatformToolset; bool ExpressEdition; bool MasmEnabled; @@ -122,5 +123,6 @@ 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/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 4caa7f2..7033f2a 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -117,7 +117,7 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32); - this->PlatformToolset = "v110"; + this->DefaultPlatformToolset = "v110"; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 6cd9f12..40f8b05 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -92,7 +92,7 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;" "ProductDir", vc12Express, cmSystemTools::KeyWOW64_32); - this->PlatformToolset = "v120"; + this->DefaultPlatformToolset = "v120"; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e5fc436..87ccfbd 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -202,16 +202,19 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory } //---------------------------------------------------------------------------- -bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts) +bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { if(this->XcodeVersion >= 30) { - this->PlatformToolset = ts; + this->GeneratorToolset = ts; + mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", + this->GeneratorToolset.c_str()); return true; } else { - return cmGlobalGenerator::SetGeneratorToolset(ts); + return cmGlobalGenerator::SetGeneratorToolset(ts, mf); } } @@ -239,11 +242,6 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - if(!this->PlatformToolset.empty()) - { - mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", - this->PlatformToolset.c_str()); - } this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -3363,10 +3361,10 @@ void cmGlobalXCodeGenerator buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET", this->CreateString(deploymentTarget)); } - if(!this->PlatformToolset.empty()) + if(!this->GeneratorToolset.empty()) { buildSettings->AddAttribute("GCC_VERSION", - this->CreateString(this->PlatformToolset.c_str())); + this->CreateString(this->GeneratorToolset.c_str())); } // Put this last so it can override existing settings diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9937ed..ae23e3b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -89,7 +89,7 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig(); - virtual bool SetGeneratorToolset(std::string const& ts); + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, @@ -246,7 +246,7 @@ private: std::map<std::string, cmXCodeObject* > TargetGroup; std::map<std::string, cmXCodeObject* > FileRefs; std::vector<std::string> Architectures; - std::string PlatformToolset; + std::string GeneratorToolset; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9906c4b..16dc724 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1462,11 +1462,6 @@ int cmake::ActualConfigure() "Name of generator toolset.", cmCacheManager::INTERNAL); } - if(!this->GeneratorToolset.empty() && - !this->GlobalGenerator->SetGeneratorToolset(this->GeneratorToolset)) - { - return -2; - } // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's |