From 1a538ae07c5a859158e603c6075b352c5f5e294e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:40:52 -0400 Subject: cmExperimental: use an `enum` for whether to forward to try_compile --- Source/cmCoreTryCompile.cxx | 3 ++- Source/cmExperimental.cxx | 6 +++--- Source/cmExperimental.h | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index cddbb9b..74f0320 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -1077,7 +1077,8 @@ cm::optional cmCoreTryCompile::TryCompileCode( i++) { auto const& data = cmExperimental::DataForFeature( static_cast(i)); - if (data.ForwardThroughTryCompile) { + if (data.ForwardThroughTryCompile == + cmExperimental::TryCompileCondition::Always) { vars.insert(data.Variable); } } diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 51c174e..fcd215c 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -24,14 +24,14 @@ cmExperimental::FeatureData LookupTable[] = { "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API", "CMake's C++ module support is experimental. It is meant only for " "experimentation and feedback to CMake developers.", - false, // https://gitlab.kitware.com/cmake/cmake/-/issues/25097 - false }, + // https://gitlab.kitware.com/cmake/cmake/-/issues/25097 + cmExperimental::TryCompileCondition::Never, false }, // WindowsKernelModeDriver { "WindowsKernelModeDriver", "5c2d848d-4efa-4529-a768-efd57171bf68", "CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER", "CMake's Windows kernel-mode driver support is experimental. It is meant " "only for experimentation and feedback to CMake developers.", - true, false }, + cmExperimental::TryCompileCondition::Always, false }, }; static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) == static_cast(cmExperimental::Feature::Sentinel), diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index 3374ba8..fa1982e 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -20,13 +20,19 @@ public: Sentinel, }; + enum class TryCompileCondition + { + Always, + Never, + }; + struct FeatureData { std::string const Name; std::string const Uuid; std::string const Variable; std::string const Description; - bool const ForwardThroughTryCompile; + TryCompileCondition const ForwardThroughTryCompile; bool Warned; }; -- cgit v0.12