summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-07-17 18:02:33 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-07-17 20:53:52 (GMT)
commitd84681d8f068225f786453a5a77791a1eb8e5459 (patch)
tree4949d7fd04d972a7db3a5b130e3812c642de563c /Source
parent1ca82e7a04b16159721c44385c3b5b8a2762f735 (diff)
downloadCMake-d84681d8f068225f786453a5a77791a1eb8e5459.zip
CMake-d84681d8f068225f786453a5a77791a1eb8e5459.tar.gz
CMake-d84681d8f068225f786453a5a77791a1eb8e5459.tar.bz2
try_compile(): Pass down CMAKE_EXPERIMENTAL_* feature flags
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx12
-rw-r--r--Source/cmExperimental.cxx1
-rw-r--r--Source/cmExperimental.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 7d4ab50..586db1b 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -18,6 +18,7 @@
#include "cmArgumentParser.h"
#include "cmConfigureLog.h"
+#include "cmExperimental.h"
#include "cmExportTryCompileFileGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmList.h"
@@ -1068,6 +1069,17 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
cmakeVariables.emplace("CMAKE_OSX_ARCHITECTURES", *tcArchs);
}
+ // Pass down CMAKE_EXPERIMENTAL_* feature flags
+ for (std::size_t i = 0;
+ i < static_cast<std::size_t>(cmExperimental::Feature::Sentinel);
+ i++) {
+ auto const& data = cmExperimental::DataForFeature(
+ static_cast<cmExperimental::Feature>(i));
+ if (data.ForwardThroughTryCompile) {
+ vars.insert(data.Variable);
+ }
+ }
+
for (std::string const& var : vars) {
if (cmValue val = this->Makefile->GetDefinition(var)) {
std::string flag = "-D" + var + "=" + *val;
diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx
index bdbd353..5d25f66 100644
--- a/Source/cmExperimental.cxx
+++ b/Source/cmExperimental.cxx
@@ -24,6 +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.",
+ false, // https://gitlab.kitware.com/cmake/cmake/-/issues/25097
false },
};
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h
index 46c5fb7..bd84bb3 100644
--- a/Source/cmExperimental.h
+++ b/Source/cmExperimental.h
@@ -25,6 +25,7 @@ public:
std::string const Uuid;
std::string const Variable;
std::string const Description;
+ bool const ForwardThroughTryCompile;
bool Warned;
};