summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-09 19:01:51 (GMT)
committerBrad King <brad.king@kitware.com>2014-09-10 15:21:51 (GMT)
commit09c8ad99433df06ed36791bfaef97996cd2de04e (patch)
tree43bad184ea59983a2cefa25e3c71debaa0b0e185 /Source
parent09ab207c668deadea3635a20812fa2f478c17f9f (diff)
downloadCMake-09c8ad99433df06ed36791bfaef97996cd2de04e.zip
CMake-09c8ad99433df06ed36791bfaef97996cd2de04e.tar.gz
CMake-09c8ad99433df06ed36791bfaef97996cd2de04e.tar.bz2
enable_language: Initialize system-specific generator info only once
Call SetSystemName, SetGeneratorPlatform, and SetGeneratorToolset exactly once after reading CMakeSystem.cmake, and not again on another call to enable_language() or project().
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx44
1 files changed, 24 insertions, 20 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 90fd3f3..4375114 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -438,7 +438,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// try and load the CMakeSystem.cmake if it is there
std::string fpath = rootBin;
- if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
+ bool const readCMakeSystem = !mf->GetDefinition("CMAKE_SYSTEM_LOADED");
+ if(readCMakeSystem)
{
fpath += "/CMakeSystem.cmake";
if(cmSystemTools::FileExists(fpath.c_str()))
@@ -472,28 +473,31 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
mf->ReadListFile(0,fpath.c_str());
}
- // Tell the generator about the target system.
- std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
- if(!this->SetSystemName(system, mf))
+ if(readCMakeSystem)
{
- cmSystemTools::SetFatalErrorOccured();
- return;
- }
+ // Tell the generator about the target system.
+ std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
+ if(!this->SetSystemName(system, mf))
+ {
+ cmSystemTools::SetFatalErrorOccured();
+ 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 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))
- {
- cmSystemTools::SetFatalErrorOccured();
- return;
+ // Tell the generator about the toolset, if any.
+ std::string toolset = mf->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET");
+ if(!this->SetGeneratorToolset(toolset, mf))
+ {
+ cmSystemTools::SetFatalErrorOccured();
+ return;
+ }
}
// **** Load the system specific initialization if not yet loaded