diff options
author | Brad King <brad.king@kitware.com> | 2014-09-05 14:25:27 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-09-05 14:38:05 -0400 |
commit | 0f1f1271e6ddcea9074afe79685a731d4295c1f5 (patch) | |
tree | 4012664a0c9ff485740fe5bf4a5982072597f323 /Source/cmake.cxx | |
parent | 4f7d0c421abf047c052cb8d459c8249310cf4f3a (diff) | |
download | cmake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.tar.gz |
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/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6cc3b81522..c9c63c714d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1445,6 +1445,34 @@ int cmake::ActualConfigure() cmCacheManager::INTERNAL); } + if(const char* platformName = + this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM")) + { + if(this->GeneratorPlatform.empty()) + { + this->GeneratorPlatform = platformName; + } + else if(this->GeneratorPlatform != platformName) + { + std::string message = "Error: generator platform: "; + message += this->GeneratorPlatform; + message += "\nDoes not match the platform used previously: "; + message += platformName; + message += + "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; + cmSystemTools::Error(message.c_str()); + return -2; + } + } + else + { + this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", + this->GeneratorPlatform.c_str(), + "Name of generator platform.", + cmCacheManager::INTERNAL); + } + if(const char* tsName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET")) { |