1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-24 19:59:47 +08:00

find_package: Add experimental gate for CPS support

This commit is contained in:
Matthew Woehlke
2024-11-19 15:22:14 -05:00
committed by Brad King
parent 25cc83428e
commit 34828650d6
4 changed files with 17 additions and 1 deletions

View File

@@ -46,6 +46,16 @@ cmExperimental::FeatureData LookupTable[] = {
{},
cmExperimental::TryCompileCondition::Always,
false },
// ImportPackageInfo
{ "ImportPackageInfo",
"e82e467b-f997-4464-8ace-b00808fff261",
"CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES",
"CMake's support for importing package information in the Common Package "
"Specification format (via find_package) is experimental. It is meant "
"only for experimentation and feedback to CMake developers.",
{},
cmExperimental::TryCompileCondition::Always,
false },
// ExportPackageInfo
{ "ExportPackageInfo",
"b80be207-778e-46ba-8080-b23bba22639e",

View File

@@ -20,6 +20,7 @@ public:
ExportPackageDependencies,
WindowsKernelModeDriver,
CxxImportStd,
ImportPackageInfo,
ExportPackageInfo,
ExportBuildDatabase,

View File

@@ -23,6 +23,7 @@
#include "cmAlgorithms.h"
#include "cmDependencyProvider.h"
#include "cmExperimental.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
@@ -829,7 +830,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// Check and eliminate search modes not allowed by the args provided
this->UseFindModules = configArgs.empty();
this->UseConfigFiles = moduleArgs.empty();
if (this->UseConfigFiles && true /* FIXME check experimental flag */) {
if (this->UseConfigFiles &&
cmExperimental::HasSupportEnabled(
*this->Makefile, cmExperimental::Feature::ImportPackageInfo)) {
this->UseCpsFiles = this->Configs.empty();
} else {
this->UseCpsFiles = false;

View File

@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.31)
project(FindPackageCpsTest)
set(CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES "e82e467b-f997-4464-8ace-b00808fff261")
# Protect tests from running inside the default install prefix.
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")