summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmMakefile.cxx78
-rw-r--r--Source/cmMakefile.h3
2 files changed, 52 insertions, 29 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 42dedc9..1905489 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -5004,38 +5004,13 @@ AddRequiredTargetFeature(cmTarget *target, const std::string& feature,
target->AppendProperty("COMPILE_FEATURES", feature.c_str());
return true;
}
- bool isCFeature = std::find_if(cmArrayBegin(C_FEATURES) + 1,
- cmArrayEnd(C_FEATURES), cmStrCmp(feature))
- != cmArrayEnd(C_FEATURES);
- bool isCxxFeature = std::find_if(cmArrayBegin(CXX_FEATURES) + 1,
- cmArrayEnd(CXX_FEATURES), cmStrCmp(feature))
- != cmArrayEnd(CXX_FEATURES);
- if (!isCFeature && !isCxxFeature)
+
+ std::string lang;
+ if (!this->CompileFeatureKnown(target, feature, lang, error))
{
- cmOStringStream e;
- if (error)
- {
- e << "specified";
- }
- else
- {
- e << "Specified";
- }
- e << " unknown feature \"" << feature << "\" for "
- "target \"" << target->GetName() << "\".";
- if (error)
- {
- *error = e.str();
- }
- else
- {
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
return false;
}
- std::string lang = isCFeature ? "C" : "CXX";
-
const char* featuresKnown =
this->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
@@ -5083,13 +5058,58 @@ AddRequiredTargetFeature(cmTarget *target, const std::string& feature,
target->AppendProperty("COMPILE_FEATURES", feature.c_str());
- return isCFeature
+ return lang == "C"
? this->AddRequiredTargetCFeature(target, feature)
: this->AddRequiredTargetCxxFeature(target, feature);
}
//----------------------------------------------------------------------------
bool cmMakefile::
+CompileFeatureKnown(cmTarget const* target, const std::string& feature,
+ std::string& lang, std::string *error) const
+{
+ assert(cmGeneratorExpression::Find(feature) == std::string::npos);
+
+ bool isCFeature = std::find_if(cmArrayBegin(C_FEATURES) + 1,
+ cmArrayEnd(C_FEATURES), cmStrCmp(feature))
+ != cmArrayEnd(C_FEATURES);
+ if (isCFeature)
+ {
+ lang = "C";
+ return true;
+ }
+ bool isCxxFeature = std::find_if(cmArrayBegin(CXX_FEATURES) + 1,
+ cmArrayEnd(CXX_FEATURES), cmStrCmp(feature))
+ != cmArrayEnd(CXX_FEATURES);
+ if (isCxxFeature)
+ {
+ lang = "CXX";
+ return true;
+ }
+ cmOStringStream e;
+ if (error)
+ {
+ e << "specified";
+ }
+ else
+ {
+ e << "Specified";
+ }
+ e << " unknown feature \"" << feature << "\" for "
+ "target \"" << target->GetName() << "\".";
+ if (error)
+ {
+ *error = e.str();
+ }
+ else
+ {
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool cmMakefile::
AddRequiredTargetCxxFeature(cmTarget *target,
const std::string& feature) const
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 90e2e19..1a7bf20 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -889,6 +889,9 @@ public:
const std::string& feature,
std::string *error = 0) const;
+ bool CompileFeatureKnown(cmTarget const* target, const std::string& feature,
+ std::string& lang, std::string *error) const;
+
void ClearMatches();
void StoreMatches(cmsys::RegularExpression& re);