2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2003-01-22 01:15:22 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2003-01-22 01:15:22 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2003-01-22 01:15:22 +03:00
|
|
|
#ifndef cmFindPackageCommand_h
|
|
|
|
#define cmFindPackageCommand_h
|
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
#include "cmFindCommon.h"
|
|
|
|
|
|
|
|
class cmFindPackageFileList;
|
2003-01-22 01:15:22 +03:00
|
|
|
|
|
|
|
/** \class cmFindPackageCommand
|
|
|
|
* \brief Load settings from an external project.
|
|
|
|
*
|
|
|
|
* cmFindPackageCommand
|
|
|
|
*/
|
2008-01-17 17:02:31 +03:00
|
|
|
class cmFindPackageCommand : public cmFindCommon
|
2003-01-22 01:15:22 +03:00
|
|
|
{
|
|
|
|
public:
|
2008-01-17 17:02:31 +03:00
|
|
|
cmFindPackageCommand();
|
|
|
|
|
2003-01-22 01:15:22 +03:00
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
virtual cmCommand* Clone() { return new cmFindPackageCommand; }
|
2003-01-22 01:15:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
2008-01-23 18:28:26 +03:00
|
|
|
virtual bool InitialPass(std::vector<std::string> const& args,
|
2016-05-16 17:34:04 +03:00
|
|
|
cmExecutionStatus& status);
|
2003-01-22 01:15:22 +03:00
|
|
|
|
2005-12-07 19:39:08 +03:00
|
|
|
/**
|
|
|
|
* This determines if the command is invoked when in script mode.
|
|
|
|
*/
|
2012-02-25 10:49:24 +04:00
|
|
|
virtual bool IsScriptable() const { return true; }
|
2005-12-07 19:39:08 +03:00
|
|
|
|
2003-01-22 01:15:22 +03:00
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
virtual std::string GetName() const { return "find_package"; }
|
2003-01-22 01:15:22 +03:00
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
cmTypeMacro(cmFindPackageCommand, cmFindCommon);
|
2016-05-16 17:34:04 +03:00
|
|
|
|
2003-01-22 01:15:22 +03:00
|
|
|
private:
|
2014-10-17 21:07:26 +04:00
|
|
|
class PathLabel : public cmFindCommon::PathLabel
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
PathLabel();
|
2016-05-16 17:34:04 +03:00
|
|
|
|
2014-10-17 21:07:26 +04:00
|
|
|
public:
|
2016-05-16 17:34:04 +03:00
|
|
|
PathLabel(const std::string& label)
|
|
|
|
: cmFindCommon::PathLabel(label)
|
|
|
|
{
|
|
|
|
}
|
2014-10-17 21:07:26 +04:00
|
|
|
static PathLabel UserRegistry;
|
|
|
|
static PathLabel Builds;
|
|
|
|
static PathLabel SystemRegistry;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Add additional search path labels and groups not present in the
|
|
|
|
// parent class
|
|
|
|
void AppendSearchPathGroups();
|
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
void AppendSuccessInformation();
|
2012-05-06 18:32:10 +04:00
|
|
|
void AppendToFoundProperty(bool found);
|
2008-09-07 14:52:06 +04:00
|
|
|
void SetModuleVariables(const std::string& components);
|
2008-01-17 17:02:31 +03:00
|
|
|
bool FindModule(bool& found);
|
2014-02-05 01:06:56 +04:00
|
|
|
void AddFindDefinition(const std::string& var, const char* val);
|
2008-12-09 18:08:54 +03:00
|
|
|
void RestoreFindDefinitions();
|
2008-01-17 17:02:31 +03:00
|
|
|
bool HandlePackageMode();
|
2009-10-07 22:37:30 +04:00
|
|
|
bool FindConfig();
|
2008-01-17 17:02:31 +03:00
|
|
|
bool FindPrefixedConfig();
|
|
|
|
bool FindFrameworkConfig();
|
|
|
|
bool FindAppBundleConfig();
|
2016-05-16 17:34:04 +03:00
|
|
|
enum PolicyScopeRule
|
|
|
|
{
|
|
|
|
NoPolicyScope,
|
|
|
|
DoPolicyScope
|
|
|
|
};
|
2009-01-22 21:18:40 +03:00
|
|
|
bool ReadListFile(const char* f, PolicyScopeRule psr);
|
2008-01-29 04:38:48 +03:00
|
|
|
void StoreVersionFound();
|
2003-01-22 01:15:22 +03:00
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
void ComputePrefixes();
|
2014-10-09 21:52:54 +04:00
|
|
|
void FillPrefixesCMakeEnvironment();
|
|
|
|
void FillPrefixesCMakeVariable();
|
|
|
|
void FillPrefixesSystemEnvironment();
|
|
|
|
void FillPrefixesUserRegistry();
|
|
|
|
void FillPrefixesSystemRegistry();
|
|
|
|
void FillPrefixesCMakeSystemVariable();
|
|
|
|
void FillPrefixesUserGuess();
|
|
|
|
void FillPrefixesUserHints();
|
2014-10-16 00:36:42 +04:00
|
|
|
void LoadPackageRegistryDir(std::string const& dir, cmSearchPath& outPaths);
|
2011-04-13 21:17:42 +04:00
|
|
|
void LoadPackageRegistryWinUser();
|
|
|
|
void LoadPackageRegistryWinSystem();
|
2014-10-09 21:52:54 +04:00
|
|
|
void LoadPackageRegistryWin(bool user, unsigned int view,
|
2014-10-16 00:36:42 +04:00
|
|
|
cmSearchPath& outPaths);
|
2014-10-09 21:52:54 +04:00
|
|
|
bool CheckPackageRegistryEntry(const std::string& fname,
|
2014-10-16 00:36:42 +04:00
|
|
|
cmSearchPath& outPaths);
|
2008-01-17 17:02:31 +03:00
|
|
|
bool SearchDirectory(std::string const& dir);
|
|
|
|
bool CheckDirectory(std::string const& dir);
|
|
|
|
bool FindConfigFile(std::string const& dir, std::string& file);
|
2008-01-29 04:38:48 +03:00
|
|
|
bool CheckVersion(std::string const& config_file);
|
2010-08-29 19:07:39 +04:00
|
|
|
bool CheckVersionFile(std::string const& version_file,
|
|
|
|
std::string& result_version);
|
2008-01-17 17:02:31 +03:00
|
|
|
bool SearchPrefix(std::string const& prefix);
|
|
|
|
bool SearchFrameworkPrefix(std::string const& prefix_in);
|
|
|
|
bool SearchAppBundlePrefix(std::string const& prefix_in);
|
|
|
|
|
|
|
|
friend class cmFindPackageFileList;
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct OriginalDef
|
|
|
|
{
|
|
|
|
bool exists;
|
|
|
|
std::string value;
|
|
|
|
};
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, OriginalDef> OriginalDefs;
|
2008-12-09 18:08:54 +03:00
|
|
|
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string Name;
|
|
|
|
std::string Variable;
|
|
|
|
std::string Version;
|
2008-01-21 16:48:33 +03:00
|
|
|
unsigned int VersionMajor;
|
|
|
|
unsigned int VersionMinor;
|
|
|
|
unsigned int VersionPatch;
|
2008-09-10 18:11:48 +04:00
|
|
|
unsigned int VersionTweak;
|
2008-01-21 16:48:33 +03:00
|
|
|
unsigned int VersionCount;
|
2008-01-29 04:38:48 +03:00
|
|
|
bool VersionExact;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string FileFound;
|
|
|
|
std::string VersionFound;
|
2008-01-29 04:38:48 +03:00
|
|
|
unsigned int VersionFoundMajor;
|
|
|
|
unsigned int VersionFoundMinor;
|
|
|
|
unsigned int VersionFoundPatch;
|
2008-09-10 18:11:48 +04:00
|
|
|
unsigned int VersionFoundTweak;
|
2008-01-29 04:38:48 +03:00
|
|
|
unsigned int VersionFoundCount;
|
2015-12-17 23:03:42 +03:00
|
|
|
KWIML_INT_uint64_t RequiredCMakeVersion;
|
2008-01-17 17:02:31 +03:00
|
|
|
bool Quiet;
|
|
|
|
bool Required;
|
2012-02-21 01:09:10 +04:00
|
|
|
bool UseConfigFiles;
|
2012-02-18 00:31:08 +04:00
|
|
|
bool UseFindModules;
|
2011-04-13 18:36:45 +04:00
|
|
|
bool NoUserRegistry;
|
2011-04-13 21:14:41 +04:00
|
|
|
bool NoSystemRegistry;
|
2008-01-17 17:02:31 +03:00
|
|
|
bool DebugMode;
|
2008-08-13 03:01:04 +04:00
|
|
|
bool UseLib64Paths;
|
2009-01-22 21:18:40 +03:00
|
|
|
bool PolicyScope;
|
2011-06-08 16:46:31 +04:00
|
|
|
std::string LibraryArchitecture;
|
2008-01-17 17:02:31 +03:00
|
|
|
std::vector<std::string> Names;
|
|
|
|
std::vector<std::string> Configs;
|
2010-08-13 02:20:47 +04:00
|
|
|
std::set<std::string> IgnoredPaths;
|
2010-08-29 19:51:44 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
struct ConfigFileInfo
|
|
|
|
{
|
|
|
|
std::string filename;
|
|
|
|
std::string version;
|
|
|
|
};
|
2010-08-29 19:51:44 +04:00
|
|
|
std::vector<ConfigFileInfo> ConsideredConfigs;
|
2003-01-22 01:15:22 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|