diff options
author | Brad King <brad.king@kitware.com> | 2014-06-04 17:21:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-06-04 18:27:02 (GMT) |
commit | 528e8af19f68c01c3a42af9e74801a39c16237dd (patch) | |
tree | d6af200ff75eb396cf5157ff9bc12f797ed8ef7c /Source/cmGlobalGenerator.cxx | |
parent | 98afb4549f66c692eeec8bbc8a1f7b333d3051a5 (diff) | |
download | CMake-528e8af19f68c01c3a42af9e74801a39c16237dd.zip CMake-528e8af19f68c01c3a42af9e74801a39c16237dd.tar.gz CMake-528e8af19f68c01c3a42af9e74801a39c16237dd.tar.bz2 |
Allow a toolchain file to specify a generator toolset
Delay use of CMAKE_GENERATOR_TOOLSET until the CMakeSystem.cmake
file has been configured and loaded during the first project() or
enable_language() command. This gives the toolchain file named by
CMAKE_TOOLCHAIN_FILE a chance to set CMAKE_GENERATOR_TOOLSET. This
point is still early enough to set the generator toolset prior to
the initialization of any languages that might use the toolset.
The cmake::GeneratorToolset member variable remains an indication
of what was specified by the -T option or loaded from the cache.
It does not need to be updated based on the toolchain file setting.
The cmMakefile::TryCompile can still pass cmake::GeneratorToolset
into the inner instance because the try-compiled project will do
platform and language initialization using the CMakeSystem module
configured for the outer project.
Extend the RunCMake.GeneratorToolset test with cases that use a
toolchain file to set CMAKE_GENERATOR_TOOLSET.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 |
1 files changed, 12 insertions, 3 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")) { |