summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-15 09:33:20 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-20 14:11:34 (GMT)
commit8dd129dfbb8f8aeefa333a0bfa5f44d835b6913e (patch)
tree3080e92328ee2dcda7a447e3fdd95c7c32299334 /Source/cmMakefile.cxx
parent6b9b2fff61777b7d18f6c550119103dd3357d6c4 (diff)
downloadCMake-8dd129dfbb8f8aeefa333a0bfa5f44d835b6913e.zip
CMake-8dd129dfbb8f8aeefa333a0bfa5f44d835b6913e.tar.gz
CMake-8dd129dfbb8f8aeefa333a0bfa5f44d835b6913e.tar.bz2
cmMakefile: Extract CompileFeaturesAvailable method.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx64
1 files changed, 38 insertions, 26 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 1905489..4317fbe 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -5011,37 +5011,14 @@ AddRequiredTargetFeature(cmTarget *target, const std::string& feature,
return false;
}
- const char* featuresKnown =
- this->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
-
- if (!featuresKnown || !*featuresKnown)
+ const char* features = this->CompileFeaturesAvailable(lang, error);
+ if (!features)
{
- cmOStringStream e;
- if (error)
- {
- e << "no";
- }
- else
- {
- e << "No";
- }
- e << " known features for " << lang << " compiler\n\""
- << this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
- << "\"\nversion "
- << this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
- if (error)
- {
- *error = e.str();
- }
- else
- {
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
return false;
}
std::vector<std::string> availableFeatures;
- cmSystemTools::ExpandListArgument(featuresKnown, availableFeatures);
+ cmSystemTools::ExpandListArgument(features, availableFeatures);
if (std::find(availableFeatures.begin(),
availableFeatures.end(),
feature) == availableFeatures.end())
@@ -5109,6 +5086,41 @@ CompileFeatureKnown(cmTarget const* target, const std::string& feature,
}
//----------------------------------------------------------------------------
+const char* cmMakefile::
+CompileFeaturesAvailable(const std::string& lang, std::string *error) const
+{
+ const char* featuresKnown =
+ this->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
+
+ if (!featuresKnown || !*featuresKnown)
+ {
+ cmOStringStream e;
+ if (error)
+ {
+ e << "no";
+ }
+ else
+ {
+ e << "No";
+ }
+ e << " known features for " << lang << " compiler\n\""
+ << this->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
+ << "\"\nversion "
+ << this->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION") << ".";
+ if (error)
+ {
+ *error = e.str();
+ }
+ else
+ {
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ return 0;
+ }
+ return featuresKnown;
+}
+
+//----------------------------------------------------------------------------
bool cmMakefile::
AddRequiredTargetCxxFeature(cmTarget *target,
const std::string& feature) const