summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-03-08 13:39:37 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-03-08 13:39:37 (GMT)
commita6e6f93b6c32c941e2ccc91c754812df049f9832 (patch)
treeca5be413f08f23bad9580a3810da2617decfe4f8 /Source
parentb14fe5c176141244a71736c34e905a3a30e84601 (diff)
parent72e0dc58d3caf63a57975e97ce13c5dc4b38cf9b (diff)
downloadCMake-a6e6f93b6c32c941e2ccc91c754812df049f9832.zip
CMake-a6e6f93b6c32c941e2ccc91c754812df049f9832.tar.gz
CMake-a6e6f93b6c32c941e2ccc91c754812df049f9832.tar.bz2
Merge topic 'toolchain-file-project'
72e0dc58 Diagnose recursive project/enable_language without crashing (#15999)
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx21
-rw-r--r--Source/cmGlobalGenerator.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 848028f..c628406 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 48fa704..6e819d3 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;