summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-15 09:32:30 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-21 15:22:32 (GMT)
commit0dfe395e3cb1a720c4853087db554a6827feaadb (patch)
tree83d9cbe0ee9843bc4aa0012d9a7064a3522ba018 /Source/cmLocalGenerator.cxx
parentaa8a6fcee8c67b0516efcd745fb1d7a66d249096 (diff)
downloadCMake-0dfe395e3cb1a720c4853087db554a6827feaadb.zip
CMake-0dfe395e3cb1a720c4853087db554a6827feaadb.tar.gz
CMake-0dfe395e3cb1a720c4853087db554a6827feaadb.tar.bz2
Features: Add COMPILE_FEATURES generator expression.
Allow setting build properties based on the features available for a target. The availability of features is determined at generate-time by evaluating the link implementation. Ensure that the <LANG>_STANDARD determined while evaluating COMPILE_FEATURES in the link implementation is not lower than that provided by the INTERFACE of the link implementation. This is similar to handling of transitive properties such as POSITION_INDEPENDENT_CODE.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a6ad714..5d58265 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1484,6 +1484,31 @@ void cmLocalGenerator::AddCompileOptions(
return;
}
}
+
+ for(std::map<std::string, std::string>::const_iterator it
+ = target->GetMaxLanguageStandards().begin();
+ it != target->GetMaxLanguageStandards().end(); ++it)
+ {
+ const char* standard = target->GetProperty(it->first + "_STANDARD");
+ if(!standard)
+ {
+ continue;
+ }
+ if (this->Makefile->IsLaterStandard(it->first, standard, it->second))
+ {
+ cmOStringStream e;
+ e << "The COMPILE_FEATURES property of target \""
+ << target->GetName() << "\" was evaluated when computing the link "
+ "implementation, and the \"" << it->first << "_STANDARD\" was \""
+ << it->second << "\" for that computation. Computing the "
+ "COMPILE_FEATURES based on the link implementation resulted in a "
+ "higher \"" << it->first << "_STANDARD\" \"" << standard << "\". "
+ "This is not permitted. The COMPILE_FEATURES may not both depend on "
+ "and be depended on by the link implementation." << std::endl;
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+ }
this->AddCompilerRequirementFlag(flags, target, lang);
}