mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-09 18:09:02 -05:00
try_compile(): Pass down CMAKE_EXPERIMENTAL_* feature flags
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "cmArgumentParser.h"
|
#include "cmArgumentParser.h"
|
||||||
#include "cmConfigureLog.h"
|
#include "cmConfigureLog.h"
|
||||||
|
#include "cmExperimental.h"
|
||||||
#include "cmExportTryCompileFileGenerator.h"
|
#include "cmExportTryCompileFileGenerator.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmList.h"
|
#include "cmList.h"
|
||||||
@@ -1068,6 +1069,17 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
|||||||
cmakeVariables.emplace("CMAKE_OSX_ARCHITECTURES", *tcArchs);
|
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) {
|
for (std::string const& var : vars) {
|
||||||
if (cmValue val = this->Makefile->GetDefinition(var)) {
|
if (cmValue val = this->Makefile->GetDefinition(var)) {
|
||||||
std::string flag = "-D" + var + "=" + *val;
|
std::string flag = "-D" + var + "=" + *val;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ cmExperimental::FeatureData LookupTable[] = {
|
|||||||
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
|
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
|
||||||
"CMake's C++ module support is experimental. It is meant only for "
|
"CMake's C++ module support is experimental. It is meant only for "
|
||||||
"experimentation and feedback to CMake developers.",
|
"experimentation and feedback to CMake developers.",
|
||||||
|
false, // https://gitlab.kitware.com/cmake/cmake/-/issues/25097
|
||||||
false },
|
false },
|
||||||
};
|
};
|
||||||
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
|
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
std::string const Uuid;
|
std::string const Uuid;
|
||||||
std::string const Variable;
|
std::string const Variable;
|
||||||
std::string const Description;
|
std::string const Description;
|
||||||
|
bool const ForwardThroughTryCompile;
|
||||||
bool Warned;
|
bool Warned;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user