diff options
author | Brad King <brad.king@kitware.com> | 2016-03-08 08:39:37 -0500 |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-03-08 08:39:37 -0500 |
commit | a6e6f93b6c32c941e2ccc91c754812df049f9832 (patch) | |
tree | ca5be413f08f23bad9580a3810da2617decfe4f8 /Source | |
parent | b14fe5c176141244a71736c34e905a3a30e84601 (diff) | |
parent | 72e0dc58d3caf63a57975e97ce13c5dc4b38cf9b (diff) | |
download | cmake-a6e6f93b6c32c941e2ccc91c754812df049f9832.tar.gz |
Merge topic 'toolchain-file-project'
72e0dc58 Diagnose recursive project/enable_language without crashing (#15999)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 21 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 848028ff31..c6284069e4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -398,6 +398,21 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, return; } + std::set<std::string> cur_languages(languages.begin(), languages.end()); + for (std::set<std::string>::iterator li = cur_languages.begin(); + li != cur_languages.end(); ++li) + { + if (!this->LanguagesInProgress.insert(*li).second) + { + std::ostringstream e; + e << "Language '" << *li << "' is currently being enabled. " + "Recursive call not allowed."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + cmSystemTools::SetFatalErrorOccured(); + return; + } + } + if(this->TryCompileOuterMakefile) { // In a try-compile we can only enable languages provided by caller. @@ -823,6 +838,12 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, { cmSystemTools::SetFatalErrorOccured(); } + + for (std::set<std::string>::iterator li = cur_languages.begin(); + li != cur_languages.end(); ++li) + { + this->LanguagesInProgress.erase(*li); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 48fa704064..6e819d3a43 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -457,6 +457,7 @@ private: // in EnableLanguagesFromGenerator std::map<std::string, bool> IgnoreExtensions; std::set<std::string> LanguagesReady; // Ready for try_compile + std::set<std::string> LanguagesInProgress; std::map<std::string, std::string> OutputExtensions; std::map<std::string, std::string> LanguageToOutputExtension; std::map<std::string, std::string> ExtensionToLanguage; |