summaryrefslogtreecommitdiff
path: root/Source/cmFindPackageCommand.h
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-09-04 19:14:41 +0200
committerMarc Chevrier <marc.chevrier@gmail.com>2020-09-23 12:52:25 +0200
commit09095dbcd2dd43763e37142b65bdaaeb34deb45d (patch)
tree7442a023ef22362a608a4faebc56b197e5879712 /Source/cmFindPackageCommand.h
parent03b3b5ab4b512b7d80871bdd7a3fe3e03f9f744a (diff)
downloadcmake-09095dbcd2dd43763e37142b65bdaaeb34deb45d.tar.gz
cmFindPackageCommand: Refactoring
* Use member initialisation at declaration * AddFindDefinition: same signature as cmMakefile::AddDefinition for consistency * Factorise version variables creation
Diffstat (limited to 'Source/cmFindPackageCommand.h')
-rw-r--r--Source/cmFindPackageCommand.h60
1 files changed, 34 insertions, 26 deletions
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index eacd1ce698..4216ad7c29 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -11,6 +11,8 @@
#include <string>
#include <vector>
+#include <cm/string_view>
+
#include <cm3p/kwiml/int.h>
#include "cmFindCommon.h"
@@ -88,9 +90,15 @@ private:
void AppendSuccessInformation();
void AppendToFoundProperty(bool found);
+ void SetVersionVariables(
+ const std::function<void(const std::string&, cm::string_view)>&
+ addDefinition,
+ const std::string& prefix, const std::string& version, unsigned int count,
+ unsigned int major, unsigned int minor, unsigned int patch,
+ unsigned int tweak);
void SetModuleVariables(const std::string& components);
bool FindModule(bool& found);
- void AddFindDefinition(const std::string& var, const char* val);
+ void AddFindDefinition(const std::string& var, cm::string_view value);
void RestoreFindDefinitions();
enum /*class*/ HandlePackageModeType
@@ -153,31 +161,31 @@ private:
std::string Name;
std::string Variable;
std::string Version;
- unsigned int VersionMajor;
- unsigned int VersionMinor;
- unsigned int VersionPatch;
- unsigned int VersionTweak;
- unsigned int VersionCount;
- bool VersionExact;
+ unsigned int VersionMajor = 0;
+ unsigned int VersionMinor = 0;
+ unsigned int VersionPatch = 0;
+ unsigned int VersionTweak = 0;
+ unsigned int VersionCount = 0;
+ bool VersionExact = false;
std::string FileFound;
std::string VersionFound;
- unsigned int VersionFoundMajor;
- unsigned int VersionFoundMinor;
- unsigned int VersionFoundPatch;
- unsigned int VersionFoundTweak;
- unsigned int VersionFoundCount;
- KWIML_INT_uint64_t RequiredCMakeVersion;
- bool Quiet;
- bool Required;
- bool UseConfigFiles;
- bool UseFindModules;
- bool NoUserRegistry;
- bool NoSystemRegistry;
- bool UseLib32Paths;
- bool UseLib64Paths;
- bool UseLibx32Paths;
- bool UseRealPath;
- bool PolicyScope;
+ unsigned int VersionFoundMajor = 0;
+ unsigned int VersionFoundMinor = 0;
+ unsigned int VersionFoundPatch = 0;
+ unsigned int VersionFoundTweak = 0;
+ unsigned int VersionFoundCount = 0;
+ KWIML_INT_uint64_t RequiredCMakeVersion = 0;
+ bool Quiet = false;
+ bool Required = false;
+ bool UseConfigFiles = true;
+ bool UseFindModules = true;
+ bool NoUserRegistry = false;
+ bool NoSystemRegistry = false;
+ bool UseLib32Paths = false;
+ bool UseLib64Paths = false;
+ bool UseLibx32Paths = false;
+ bool UseRealPath = false;
+ bool PolicyScope = true;
std::string LibraryArchitecture;
std::vector<std::string> Names;
std::vector<std::string> Configs;
@@ -185,9 +193,9 @@ private:
std::string DebugBuffer;
/*! the selected sortOrder (None by default)*/
- SortOrderType SortOrder;
+ SortOrderType SortOrder = None;
/*! the selected sortDirection (Asc by default)*/
- SortDirectionType SortDirection;
+ SortDirectionType SortDirection = Asc;
struct ConfigFileInfo
{