diff options
author | Brad King <brad.king@kitware.com> | 2016-09-27 09:33:58 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-28 10:34:57 -0400 |
commit | 9c5238dfd6a3aa1d7e0ba30f302e75ffbc893851 (patch) | |
tree | bc92323c6a686db17683cb537e0697e564e9fbd9 /Source/cmMakefile.cxx | |
parent | 40c0482153b54f60cd2f2e573cc1183df56e8a76 (diff) | |
download | cmake-9c5238dfd6a3aa1d7e0ba30f302e75ffbc893851.tar.gz |
project: Fix support for explicit RC language
The check added in commit v3.6.0-rc1~293^2 (Diagnose recursive
project/enable_language without crashing, 2016-03-07) broke support for
enabling `RC` explicitly along with other languages like `C`. The
reason is that we enable all listed languages at once so the internal
`enable_language(RC)` that we do while enabling `C` or `CXX` on some
platforms triggers the recursion check if `RC` is explicitly listed.
Ideally we should refactor things to only enable one language at a time,
but for now it is simplest to just exclude `RC` from the explicit list
until other languages are enabled, and then enable it.
Closes: #16330
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 48e6c61826..df993ceb7e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3142,7 +3142,26 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const& lang, { this->AddDefinition("CMAKE_CFG_INTDIR", this->GetGlobalGenerator()->GetCMakeCFGIntDir()); - this->GetGlobalGenerator()->EnableLanguage(lang, this, optional); + // If RC is explicitly listed we need to do it after other languages. + // On some platforms we enable RC implicitly while enabling others. + // Do not let that look like recursive enable_language(RC). + std::vector<std::string> langs; + std::vector<std::string> langsRC; + langs.reserve(lang.size()); + for (std::vector<std::string>::const_iterator i = lang.begin(); + i != lang.end(); ++i) { + if (i->compare("RC") == 0) { + langsRC.push_back(*i); + } else { + langs.push_back(*i); + } + } + if (!langs.empty()) { + this->GetGlobalGenerator()->EnableLanguage(langs, this, optional); + } + if (!langsRC.empty()) { + this->GetGlobalGenerator()->EnableLanguage(langsRC, this, optional); + } } int cmMakefile::TryCompile(const std::string& srcdir, |