diff options
author | Brad King <brad.king@kitware.com> | 2014-09-05 18:25:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-09-05 18:38:05 (GMT) |
commit | 0f1f1271e6ddcea9074afe79685a731d4295c1f5 (patch) | |
tree | 4012664a0c9ff485740fe5bf4a5982072597f323 /Source/cmGlobalGenerator.cxx | |
parent | 4f7d0c421abf047c052cb8d459c8249310cf4f3a (diff) | |
download | CMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.zip CMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.tar.gz CMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.tar.bz2 |
CMake: Add CMAKE_GENERATOR_PLATFORM option
Reject the option by default. It will be implemented on a per-generator
basis. Pass the setting into try_compile project generation. Add cache
entry CMAKE_GENERATOR_PLATFORM and associated variable documentation to
hold the value persistently.
Add a RunCMake.GeneratorPlatform test to cover basic use cases for the
option. Verify that CMAKE_GENERATOR_PLATFORM is empty by default, and
that it is rejected when the generator does not support a user setting.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 42efec2..90fd3f3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -76,6 +76,27 @@ cmGlobalGenerator::~cmGlobalGenerator() } } +bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if(p.empty()) + { + return true; + } + else + { + cmOStringStream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support platform specification, but platform\n" + " " << p << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } +} + bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { @@ -459,6 +480,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, return; } + // Tell the generator about the platform, if any. + std::string platform = mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM"); + if(!this->SetGeneratorPlatform(platform, mf)) + { + cmSystemTools::SetFatalErrorOccured(); + return; + } + // Tell the generator about the toolset, if any. std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"); if(!this->SetGeneratorToolset(toolset, mf)) |