summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx4
-rw-r--r--Source/cmStandardLevelResolver.cxx25
-rw-r--r--Source/cmStandardLevelResolver.h1
3 files changed, 17 insertions, 13 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 422d927..2454750 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -50,6 +50,7 @@
#include "cmSourceFileLocation.h"
#include "cmSourceFileLocationKind.h"
#include "cmSourceGroup.h"
+#include "cmStandardLevel.h"
#include "cmStandardLevelResolver.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
@@ -5039,10 +5040,11 @@ bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const
std::string key = cmStrCat(cmSystemTools::UpperCase(config), '-', lang);
cmValue currentLanguageStandard = this->GetLanguageStandard(lang, config);
+ cm::optional<cmStandardLevel> featureLevel;
std::string newRequiredStandard;
if (!standardResolver.GetNewRequiredStandard(
this->Target->GetName(), f.Value, currentLanguageStandard,
- newRequiredStandard)) {
+ featureLevel, newRequiredStandard)) {
return false;
}
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index a24d480..4a149e0 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -337,7 +337,7 @@ struct StandardLevelComputer
bool GetNewRequiredStandard(cmMakefile* makefile,
std::string const& targetName,
- const std::string& feature,
+ cm::optional<cmStandardLevel> featureLevel,
cmValue currentLangStandardValue,
std::string& newRequiredStandard,
std::string* error) const
@@ -348,9 +348,6 @@ struct StandardLevelComputer
newRequiredStandard.clear();
}
- cm::optional<cmStandardLevel> needed =
- this->CompileFeatureStandardLevel(makefile, feature);
-
cmValue existingStandard = currentLangStandardValue;
if (!existingStandard) {
cmValue defaultStandard = makefile->GetDefinition(
@@ -379,12 +376,12 @@ struct StandardLevelComputer
}
}
- if (needed) {
+ if (featureLevel) {
// Ensure the C++ language level is high enough to support
// the needed C++ features.
if (existingLevelIter == cm::cend(this->Levels) ||
- existingLevelIter < this->Levels.begin() + needed->Index()) {
- newRequiredStandard = this->LevelsAsStrings[needed->Index()];
+ existingLevelIter < this->Levels.begin() + featureLevel->Index()) {
+ newRequiredStandard = this->LevelsAsStrings[featureLevel->Index()];
}
}
@@ -550,11 +547,12 @@ bool cmStandardLevelResolver::AddRequiredTargetFeature(
// should be done purely at generate time based on whatever the project
// code put in these properties explicitly. That is mostly true now,
// but for compatibility we need to continue updating the property here.
+ cm::optional<cmStandardLevel> featureLevel;
std::string newRequiredStandard;
bool succeeded = this->GetNewRequiredStandard(
target->GetName(), feature,
- target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard,
- error);
+ target->GetProperty(cmStrCat(lang, "_STANDARD")), featureLevel,
+ newRequiredStandard, error);
if (!newRequiredStandard.empty()) {
target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard);
}
@@ -711,18 +709,21 @@ cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
bool cmStandardLevelResolver::GetNewRequiredStandard(
const std::string& targetName, const std::string& feature,
- cmValue currentLangStandardValue, std::string& newRequiredStandard,
- std::string* error) const
+ cmValue currentLangStandardValue,
+ cm::optional<cmStandardLevel>& featureLevel,
+ std::string& newRequiredStandard, std::string* error) const
{
std::string lang;
if (!this->CheckCompileFeaturesAvailable(targetName, feature, lang, error)) {
return false;
}
+ featureLevel = this->CompileFeatureStandardLevel(lang, feature);
+
auto mapping = StandardComputerMapping.find(lang);
if (mapping != cm::cend(StandardComputerMapping)) {
return mapping->second.GetNewRequiredStandard(
- this->Makefile, targetName, feature, currentLangStandardValue,
+ this->Makefile, targetName, featureLevel, currentLangStandardValue,
newRequiredStandard, error);
}
return false;
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 2dd978c..09989ba 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -45,6 +45,7 @@ public:
bool GetNewRequiredStandard(const std::string& targetName,
const std::string& feature,
cmValue currentLangStandardValue,
+ cm::optional<cmStandardLevel>& featureLevel,
std::string& newRequiredStandard,
std::string* error = nullptr) const;