summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-04-30 16:07:38 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-07 10:17:49 (GMT)
commit205215fb8a8aa950026d914377a54ae358a1c02a (patch)
tree2e847006ba3a5e19448058ff09ad6b496fe4b39b /Source
parent1df2116bfaa4c575404ae1eef225aed1530d668a (diff)
downloadCMake-205215fb8a8aa950026d914377a54ae358a1c02a.zip
CMake-205215fb8a8aa950026d914377a54ae358a1c02a.tar.gz
CMake-205215fb8a8aa950026d914377a54ae358a1c02a.tar.bz2
cmTarget: Add CXX_STANDARD_REQUIRED to control decay.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx20
-rw-r--r--Source/cmTarget.cxx1
2 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a29a0cd..afb2ce8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2161,6 +2161,26 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
bool ext = target->GetPropertyAsBool(extProp);
std::string type = ext ? "EXTENSION" : "STANDARD";
+ if (target->GetPropertyAsBool(lang + "_STANDARD_REQUIRED"))
+ {
+ std::string option_flag =
+ "CMAKE_" + lang + standardProp
+ + "_" + type + "_COMPILE_OPTION";
+
+ const char *opt = target->GetMakefile()->GetDefinition(option_flag);
+ if (!opt)
+ {
+ cmOStringStream e;
+ e << "Target \"" << target->GetName() << "\" requires the language "
+ "dialect \"" << lang << standardProp << "\" "
+ << (ext ? "(with compiler extensions)" : "") << ", but CMake "
+ "does not know the compile flags to use to enable it.";
+ this->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+ this->AppendFlags(flags, opt);
+ return;
+ }
+
static std::map<std::string, std::vector<std::string> > langStdMap;
if (langStdMap.empty())
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ee6cb44..3436bb4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -315,6 +315,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("MACOSX_RPATH", 0);
this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
this->SetPropertyDefault("CXX_STANDARD", 0);
+ this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0);
this->SetPropertyDefault("CXX_EXTENSIONS", 0);
}