summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx40
-rw-r--r--Source/cmGeneratorTarget.h8
2 files changed, 47 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index bbd5789..1c339de 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5025,10 +5025,44 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
}
}
+cm::optional<cmStandardLevel> cmGeneratorTarget::GetExplicitStandardLevel(
+ std::string const& lang, std::string const& config) const
+{
+ cm::optional<cmStandardLevel> level;
+ std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang);
+ auto i = this->ExplicitStandardLevel.find(key);
+ if (i != this->ExplicitStandardLevel.end()) {
+ level = i->second;
+ }
+ return level;
+}
+
+void cmGeneratorTarget::UpdateExplicitStandardLevel(std::string const& lang,
+ std::string const& config,
+ cmStandardLevel level)
+{
+ auto e = this->ExplicitStandardLevel.emplace(
+ cmStrCat(cmSystemTools::UpperCase(config), '-', lang), level);
+ if (!e.second && e.first->second < level) {
+ e.first->second = level;
+ }
+}
+
bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config)
{
- // Compute the language standard based on the compile features.
cmStandardLevelResolver standardResolver(this->Makefile);
+
+ for (std::string const& lang :
+ this->Makefile->GetState()->GetEnabledLanguages()) {
+ if (cmValue languageStd = this->GetLanguageStandard(lang, config)) {
+ if (cm::optional<cmStandardLevel> langLevel =
+ standardResolver.LanguageStandardLevel(lang, *languageStd)) {
+ this->UpdateExplicitStandardLevel(lang, config, *langLevel);
+ }
+ }
+ }
+
+ // Compute the language standard based on the compile features.
std::vector<BT<std::string>> features = this->GetCompileFeatures(config);
for (BT<std::string> const& f : features) {
std::string lang;
@@ -5048,6 +5082,10 @@ bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config)
return false;
}
+ if (featureLevel) {
+ this->UpdateExplicitStandardLevel(lang, config, *featureLevel);
+ }
+
if (!newRequiredStandard.empty()) {
BTs<std::string>& languageStandardProperty =
this->LanguageStandardMap[key];
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6bdb7ff..bf49914 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -21,6 +21,7 @@
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
+#include "cmStandardLevel.h"
#include "cmStateTypes.h"
#include "cmValue.h"
@@ -1242,6 +1243,13 @@ private:
std::map<std::string, BTs<std::string>> LanguageStandardMap;
+ cm::optional<cmStandardLevel> GetExplicitStandardLevel(
+ std::string const& lang, std::string const& config) const;
+ void UpdateExplicitStandardLevel(std::string const& lang,
+ std::string const& config,
+ cmStandardLevel level);
+ std::map<std::string, cmStandardLevel> ExplicitStandardLevel;
+
cmValue GetPropertyWithPairedLanguageSupport(std::string const& lang,
const char* suffix) const;