summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-27 13:14:31 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-27 13:14:31 (GMT)
commitfd771df773224560a60850647b898280a0ec84fa (patch)
tree467297468a88efb74f2c042a7674b993d3fb8a94 /Source
parent1d86103846d4e8557c3cc77d3c1f2dce9231663d (diff)
parente03a1b3b6185e36a5905db3d2551c9575fb074aa (diff)
downloadCMake-fd771df773224560a60850647b898280a0ec84fa.zip
CMake-fd771df773224560a60850647b898280a0ec84fa.tar.gz
CMake-fd771df773224560a60850647b898280a0ec84fa.tar.bz2
Merge branch 'fix-crash-on-non-enabled-language-features' into release-3.9
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 802a427..608b18a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4190,6 +4190,23 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
std::string* error) const
{
+ if (!this->GlobalGenerator->GetLanguageEnabled(lang)) {
+ std::ostringstream e;
+ if (error) {
+ e << "cannot";
+ } else {
+ e << "Cannot";
+ }
+ e << " use features from non-enabled language " << lang;
+ if (error) {
+ *error = e.str();
+ } else {
+ this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(),
+ this->Backtrace);
+ }
+ return CM_NULLPTR;
+ }
+
const char* featuresKnown =
this->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
@@ -4201,9 +4218,9 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang,
e << "No";
}
e << " known features for " << lang << " compiler\n\""
- << this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
+ << this->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID")
<< "\"\nversion "
- << this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
+ << this->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
if (error) {
*error = e.str();
} else {