mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 02:59:22 -05:00
find_package: Start implementing CPS search
Teach find_package to search CPS search paths, and to look for CPS file names. Modify the set of file names to also include the file type (CPS or CMake-script). Modify the search function to allow specifying which file type(s) to consider. During full path search, each possible path is searched for only one of the two possible file types. However, subsequent runs, or when considering a user-specified path (<name>_DIR), CMake will look for both file types. Note that this only adds the new path search logic as described above; CMake does not yet know how to read CPS files, and there is a high likelihood that Bad Things will happen if it tries. However, this seemed like a good place to checkpoint.
This commit is contained in:
committed by
Brad King
parent
3e9f96079d
commit
b89e43b2bc
@@ -9,6 +9,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cm/string_view>
|
||||
@@ -56,6 +57,13 @@ public:
|
||||
Dec
|
||||
};
|
||||
|
||||
enum class PackageDescriptionType
|
||||
{
|
||||
Any,
|
||||
CMake,
|
||||
Cps,
|
||||
};
|
||||
|
||||
/*! sorts a given list of string based on the input sort parameters */
|
||||
static void Sort(std::vector<std::string>::iterator begin,
|
||||
std::vector<std::string>::iterator end, SortOrderType order,
|
||||
@@ -120,6 +128,7 @@ private:
|
||||
bool FindPrefixedConfig();
|
||||
bool FindFrameworkConfig();
|
||||
bool FindAppBundleConfig();
|
||||
bool FindEnvironmentConfig();
|
||||
enum PolicyScopeRule
|
||||
{
|
||||
NoPolicyScope,
|
||||
@@ -151,15 +160,17 @@ private:
|
||||
cmSearchPath& outPaths);
|
||||
bool CheckPackageRegistryEntry(const std::string& fname,
|
||||
cmSearchPath& outPaths);
|
||||
bool SearchDirectory(std::string const& dir);
|
||||
bool CheckDirectory(std::string const& dir);
|
||||
bool FindConfigFile(std::string const& dir, std::string& file);
|
||||
bool SearchDirectory(std::string const& dir, PackageDescriptionType type);
|
||||
bool CheckDirectory(std::string const& dir, PackageDescriptionType type);
|
||||
bool FindConfigFile(std::string const& dir, PackageDescriptionType type,
|
||||
std::string& file);
|
||||
bool CheckVersion(std::string const& config_file);
|
||||
bool CheckVersionFile(std::string const& version_file,
|
||||
std::string& result_version);
|
||||
bool SearchPrefix(std::string const& prefix);
|
||||
bool SearchFrameworkPrefix(std::string const& prefix_in);
|
||||
bool SearchAppBundlePrefix(std::string const& prefix_in);
|
||||
bool SearchEnvironmentPrefix(std::string const& prefix_in);
|
||||
|
||||
struct OriginalDef
|
||||
{
|
||||
@@ -202,6 +213,7 @@ private:
|
||||
KWIML_INT_uint64_t RequiredCMakeVersion = 0;
|
||||
bool Quiet = false;
|
||||
bool Required = false;
|
||||
bool UseCpsFiles = false;
|
||||
bool UseConfigFiles = true;
|
||||
bool UseFindModules = true;
|
||||
bool NoUserRegistry = false;
|
||||
@@ -215,7 +227,6 @@ private:
|
||||
bool RegistryViewDefined = false;
|
||||
std::string LibraryArchitecture;
|
||||
std::vector<std::string> Names;
|
||||
std::vector<std::string> Configs;
|
||||
std::set<std::string> IgnoredPaths;
|
||||
std::set<std::string> IgnoredPrefixPaths;
|
||||
std::string Components;
|
||||
@@ -223,6 +234,26 @@ private:
|
||||
std::set<std::string> OptionalComponents;
|
||||
std::string DebugBuffer;
|
||||
|
||||
struct ConfigName
|
||||
{
|
||||
ConfigName(std::string const& name, PackageDescriptionType type)
|
||||
: Name{ name }
|
||||
, Type{ type }
|
||||
{
|
||||
}
|
||||
ConfigName(std::string&& name, PackageDescriptionType type)
|
||||
: Name{ std::move(name) }
|
||||
, Type{ type }
|
||||
{
|
||||
}
|
||||
ConfigName(ConfigName const&) = default;
|
||||
ConfigName(ConfigName&&) = default;
|
||||
|
||||
std::string Name;
|
||||
PackageDescriptionType Type;
|
||||
};
|
||||
std::vector<ConfigName> Configs;
|
||||
|
||||
class FlushDebugBufferOnExit;
|
||||
|
||||
/*! the selected sortOrder (None by default)*/
|
||||
|
||||
Reference in New Issue
Block a user