Browse Source

cmExperimental: only forward C++ module support to non-ABI checks

ABI checks never use modules, so don't forward the experimental status
through.
Ben Boeckel 2 years ago
parent
commit
f6cf433256
3 changed files with 7 additions and 3 deletions
  1. 5 1
      Source/cmCoreTryCompile.cxx
  2. 1 2
      Source/cmExperimental.cxx
  3. 1 0
      Source/cmExperimental.h

+ 5 - 1
Source/cmCoreTryCompile.cxx

@@ -1078,7 +1078,11 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
       auto const& data = cmExperimental::DataForFeature(
         static_cast<cmExperimental::Feature>(i));
       if (data.ForwardThroughTryCompile ==
-          cmExperimental::TryCompileCondition::Always) {
+            cmExperimental::TryCompileCondition::Always ||
+          (data.ForwardThroughTryCompile ==
+             cmExperimental::TryCompileCondition::SkipCompilerChecks &&
+           arguments.CMakeInternal != "ABI"_s &&
+           arguments.CMakeInternal != "FEATURE_TESTING"_s)) {
         vars.insert(data.Variable);
       }
     }

+ 1 - 2
Source/cmExperimental.cxx

@@ -24,8 +24,7 @@ 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.",
-    // https://gitlab.kitware.com/cmake/cmake/-/issues/25097
-    cmExperimental::TryCompileCondition::Never, false },
+    cmExperimental::TryCompileCondition::SkipCompilerChecks, false },
   // WindowsKernelModeDriver
   { "WindowsKernelModeDriver", "5c2d848d-4efa-4529-a768-efd57171bf68",
     "CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER",

+ 1 - 0
Source/cmExperimental.h

@@ -23,6 +23,7 @@ public:
   enum class TryCompileCondition
   {
     Always,
+    SkipCompilerChecks,
     Never,
   };