From ff30a5397d804b9de564d54868bd5fdf504361c2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 24 May 2022 17:20:42 -0400 Subject: cmExperimental: add an experimental feature to handle C++ modules --- Help/dev/experimental.rst | 17 +++++++++++++++++ Source/cmExperimental.cxx | 9 ++++++++- Source/cmExperimental.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst index 7638d22..2c2eb21 100644 --- a/Help/dev/experimental.rst +++ b/Help/dev/experimental.rst @@ -7,6 +7,23 @@ See documentation on `CMake Development`_ for more information. .. _`CMake Development`: README.rst +Features are gated behind ``CMAKE_EXPERIMENTAL_`` variables which must be set +to specific values in order to enable their gated behaviors. Note that the +specific values will change over time to reinforce their experimental nature. +When used, a warning will be generated to indicate that an experimental +feature is in use and that the affected behavior in the project is not part of +CMake's stability guarantees. + +C++20 Module APIs +================= + +Variable: ``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API`` +Value: ``17be90bd-a850-44e0-be50-448de847d652`` + +In order to support C++20 modules, there are a number of behaviors that have +CMake APIs to provide the required features to build and export them from a +project. + C++20 Module Dependencies ========================= diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 5689714..e815d0e 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -25,7 +25,14 @@ struct FeatureData std::string const Variable; std::string const Description; bool Warned; -} LookupTable[] = {}; +} LookupTable[] = { + // CxxModuleCMakeApi + { "17be90bd-a850-44e0-be50-448de847d652", + "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 }, +}; static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) == static_cast(cmExperimental::Feature::Sentinel), "Experimental feature lookup table mismatch"); diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index c2df019..26e0d17 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -12,6 +12,8 @@ class cmExperimental public: enum class Feature { + CxxModuleCMakeApi, + Sentinel, }; -- cgit v0.12