summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-15 14:32:11 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-04-15 14:32:11 (GMT)
commitb56a9ae7f14189fd2bce2ca3e9441060ca231638 (patch)
tree0122235518aa6041be6866711fb2433b8c191070 /Source/cmLocalGenerator.cxx
parent593b69c9dc9e692b198f1ddbf9251130e61a4679 (diff)
parent9eaf3755987821080908a289cefbf546773071f9 (diff)
downloadCMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.zip
CMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.tar.gz
CMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.tar.bz2
Merge topic 'target_compile_features'
9eaf3755 Export: Populate INTERFACE_COMPILE_FEATURES property. 8ed59fc2 Add target_compile_features command. 4e6ca504 cmTargetPropCommandBase: Change the interface to return bool. 5412dede cmTarget: Transitively evaluate compiler features. baff4434 cmTarget: Allow populating COMPILE_FEATURES using generator expressions. f97bf437 Features: Add cxx_auto_type. 03355d6b cmTarget: Add COMPILE_FEATURES target property. faeddf64 project: Add infrastructure for recording CXX compiler features 913394af cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties. 8238a6cd Add some COMPILE_OPTIONS for specifying C++ dialect. 892243fc Tests: Require CMake 3.0 for the SystemInformation test. 59b5fdd3 Don't load Clang-CXX from AppleClang-CXX.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8e56d2f..f375b5f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1460,6 +1460,17 @@ void cmLocalGenerator::AddCompileOptions(
this->AppendFlagEscape(flags, *i);
}
}
+ std::vector<std::string> features;
+ target->GetCompileFeatures(features, config);
+ for(std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it)
+ {
+ if (!this->Makefile->AddRequiredTargetFeature(target, *it))
+ {
+ return;
+ }
+ }
+ this->AddCompilerRequirementFlag(flags, target, lang);
}
//----------------------------------------------------------------------------
@@ -2131,6 +2142,34 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
}
}
+//----------------------------------------------------------------------------
+void cmLocalGenerator::
+AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
+ const std::string& lang)
+{
+ if (lang.empty())
+ {
+ return;
+ }
+ std::string stdProp = lang + "_STANDARD";
+ const char *standard = target->GetProperty(stdProp);
+ if (!standard)
+ {
+ return;
+ }
+ std::string extProp = lang + "_EXTENSIONS";
+ bool ext = target->GetPropertyAsBool(extProp);
+ std::string type = ext ? "EXTENSION" : "STANDARD";
+
+ std::string compile_option =
+ "CMAKE_" + lang + std::string(standard)
+ + "_" + type + "_COMPILE_OPTION";
+ if (const char *opt = target->GetMakefile()->GetDefinition(compile_option))
+ {
+ this->AppendFlags(flags, opt);
+ }
+}
+
static void AddVisibilityCompileOption(std::string &flags, cmTarget* target,
cmLocalGenerator *lg,
const std::string& lang)