summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakeLanguageCommand.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2024-04-10 04:56:32 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2024-04-10 04:56:44 (GMT)
commit46da8e64b03578e3b7b7059574ee2efff7be071c (patch)
tree52481f263ef1a75e73ee5f1bb65fce9ae106db5d /Source/cmCMakeLanguageCommand.cxx
parente8582abc6d13840b1885abdc0de4ad94b1157c94 (diff)
downloadCMake-46da8e64b03578e3b7b7059574ee2efff7be071c.zip
CMake-46da8e64b03578e3b7b7059574ee2efff7be071c.tar.gz
CMake-46da8e64b03578e3b7b7059574ee2efff7be071c.tar.bz2
cmCMakeLanguageCommand: use `cmExperimental::FeatureByName`
Diffstat (limited to 'Source/cmCMakeLanguageCommand.cxx')
-rw-r--r--Source/cmCMakeLanguageCommand.cxx21
1 files changed, 6 insertions, 15 deletions
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index 9ffc363..fe9257e 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -345,27 +345,18 @@ bool cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED(
auto const& featureName = expandedArgs[1];
auto const& variableName = expandedArgs[2];
- auto feature = cmExperimental::Feature::Sentinel;
- for (std::size_t i = 0;
- i < static_cast<std::size_t>(cmExperimental::Feature::Sentinel); i++) {
- if (cmExperimental::DataForFeature(static_cast<cmExperimental::Feature>(i))
- .Name == featureName) {
- feature = static_cast<cmExperimental::Feature>(i);
- break;
+ if (auto feature = cmExperimental::FeatureByName(featureName)) {
+ if (cmExperimental::HasSupportEnabled(makefile, *feature)) {
+ makefile.AddDefinition(variableName, "TRUE");
+ } else {
+ makefile.AddDefinition(variableName, "FALSE");
}
- }
- if (feature == cmExperimental::Feature::Sentinel) {
+ } else {
return FatalError(status,
cmStrCat("Experimental feature name \"", featureName,
"\" does not exist."));
}
- if (cmExperimental::HasSupportEnabled(makefile, feature)) {
- makefile.AddDefinition(variableName, "TRUE");
- } else {
- makefile.AddDefinition(variableName, "FALSE");
- }
-
return true;
}
}