Browse Source

cmExperimental: add an experimental feature to handle C++ modules

Ben Boeckel 3 years ago
parent
commit
ff30a5397d
3 changed files with 27 additions and 1 deletions
  1. 17 0
      Help/dev/experimental.rst
  2. 8 1
      Source/cmExperimental.cxx
  3. 2 0
      Source/cmExperimental.h

+ 17 - 0
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
 =========================
 

+ 8 - 1
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<size_t>(cmExperimental::Feature::Sentinel),
               "Experimental feature lookup table mismatch");

+ 2 - 0
Source/cmExperimental.h

@@ -12,6 +12,8 @@ class cmExperimental
 public:
   enum class Feature
   {
+    CxxModuleCMakeApi,
+
     Sentinel,
   };