find_package: Actually find .cps files

Add a helper class to read CPS files. Use this to teach find_package how
to consider and accept .cps files in its search. (Note that no version
testing is performed at this time.) Add a simple test that we can find a
package from a .cps file and correctly extract the version information.

Note that this doesn't actually import anything from CPS yet.
This commit is contained in:
Matthew Woehlke
2024-12-13 08:58:24 -05:00
committed by Brad King
parent b89e43b2bc
commit 91c31ada23
10 changed files with 305 additions and 18 deletions
+4
View File
@@ -7,6 +7,7 @@
#include <cstddef>
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -17,6 +18,7 @@
#include <cm3p/kwiml/int.h>
#include "cmFindCommon.h"
#include "cmPackageInfoReader.h"
#include "cmPolicies.h"
// IWYU insists we should forward-declare instead of including <functional>,
@@ -283,6 +285,8 @@ private:
};
std::vector<ConfigFileInfo> ConsideredConfigs;
std::unique_ptr<cmPackageInfoReader> CpsReader;
friend struct std::hash<ConfigFileInfo>;
};