2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2008-01-17 17:02:31 +03:00
|
|
|
#ifndef cmFindCommon_h
|
|
|
|
#define cmFindCommon_h
|
|
|
|
|
|
|
|
#include "cmCommand.h"
|
2014-10-17 21:07:26 +04:00
|
|
|
#include "cmPathLabel.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmSearchPath.h"
|
2008-01-17 17:02:31 +03:00
|
|
|
|
|
|
|
/** \class cmFindCommon
|
|
|
|
* \brief Base class for FIND_XXX implementations.
|
|
|
|
*
|
|
|
|
* cmFindCommon is a parent class for cmFindBase,
|
|
|
|
* cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
|
|
|
|
* cmFindFileCommand, and cmFindPackageCommand.
|
|
|
|
*/
|
|
|
|
class cmFindCommon : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmFindCommon();
|
2016-06-27 22:25:27 +03:00
|
|
|
~cmFindCommon() CM_OVERRIDE;
|
2008-01-17 17:02:31 +03:00
|
|
|
cmTypeMacro(cmFindCommon, cmCommand);
|
|
|
|
|
|
|
|
protected:
|
2014-10-16 00:36:42 +04:00
|
|
|
friend class cmSearchPath;
|
2008-01-17 17:02:31 +03:00
|
|
|
|
2014-10-17 21:07:26 +04:00
|
|
|
/** Used to define groups of path labels */
|
|
|
|
class PathGroup : public cmPathLabel
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
PathGroup();
|
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
|
|
|
PathGroup(const std::string& label)
|
|
|
|
: cmPathLabel(label)
|
|
|
|
{
|
|
|
|
}
|
2014-10-17 21:07:26 +04:00
|
|
|
static PathGroup All;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Individual path types */
|
|
|
|
class PathLabel : public cmPathLabel
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
: cmPathLabel(label)
|
|
|
|
{
|
|
|
|
}
|
2014-10-17 21:07:26 +04:00
|
|
|
static PathLabel CMake;
|
|
|
|
static PathLabel CMakeEnvironment;
|
|
|
|
static PathLabel Hints;
|
|
|
|
static PathLabel SystemEnvironment;
|
|
|
|
static PathLabel CMakeSystem;
|
|
|
|
static PathLabel Guess;
|
|
|
|
};
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
enum RootPathMode
|
|
|
|
{
|
|
|
|
RootPathModeNever,
|
|
|
|
RootPathModeOnly,
|
|
|
|
RootPathModeBoth
|
|
|
|
};
|
2014-10-09 21:52:54 +04:00
|
|
|
|
2014-10-17 21:07:26 +04:00
|
|
|
/** Construct the various path groups and labels */
|
|
|
|
void InitializeSearchPathGroups();
|
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
/** Place a set of search paths under the search roots. */
|
|
|
|
void RerootPaths(std::vector<std::string>& paths);
|
|
|
|
|
2010-08-13 02:20:47 +04:00
|
|
|
/** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables. */
|
|
|
|
void GetIgnoredPaths(std::vector<std::string>& ignore);
|
|
|
|
void GetIgnoredPaths(std::set<std::string>& ignore);
|
|
|
|
|
|
|
|
/** Remove paths in the ignore set from the supplied vector. */
|
2014-10-09 21:52:54 +04:00
|
|
|
void FilterPaths(const std::vector<std::string>& inPaths,
|
|
|
|
const std::set<std::string>& ignore,
|
|
|
|
std::vector<std::string>& outPaths);
|
2010-08-13 02:20:47 +04:00
|
|
|
|
2011-09-23 22:27:25 +04:00
|
|
|
/** Compute final search path list (reroot + trailing slash). */
|
|
|
|
void ComputeFinalPaths();
|
2008-06-09 19:57:56 +04:00
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
/** Compute the current default root path mode. */
|
|
|
|
void SelectDefaultRootPathMode();
|
|
|
|
|
|
|
|
/** Compute the current default bundle/framework search policy. */
|
|
|
|
void SelectDefaultMacMode();
|
|
|
|
|
2014-10-16 00:36:42 +04:00
|
|
|
// Path arguments prior to path manipulation routines
|
|
|
|
std::vector<std::string> UserHintsArgs;
|
|
|
|
std::vector<std::string> UserGuessArgs;
|
|
|
|
|
2014-02-10 09:21:34 +04:00
|
|
|
std::string CMakePathName;
|
2008-01-17 17:02:31 +03:00
|
|
|
RootPathMode FindRootPathMode;
|
|
|
|
|
|
|
|
bool CheckCommonArgument(std::string const& arg);
|
|
|
|
void AddPathSuffix(std::string const& arg);
|
2010-05-01 16:29:13 +04:00
|
|
|
void SetMakefile(cmMakefile* makefile);
|
|
|
|
|
2008-01-17 17:02:31 +03:00
|
|
|
bool NoDefaultPath;
|
|
|
|
bool NoCMakePath;
|
|
|
|
bool NoCMakeEnvironmentPath;
|
|
|
|
bool NoSystemEnvironmentPath;
|
|
|
|
bool NoCMakeSystemPath;
|
|
|
|
|
|
|
|
std::vector<std::string> SearchPathSuffixes;
|
2014-10-17 21:07:26 +04:00
|
|
|
|
|
|
|
std::map<PathGroup, std::vector<PathLabel> > PathGroupLabelMap;
|
|
|
|
std::vector<PathGroup> PathGroupOrder;
|
|
|
|
std::map<std::string, PathLabel> PathLabelStringMap;
|
|
|
|
std::map<PathLabel, cmSearchPath> LabeledPaths;
|
2014-10-09 21:52:54 +04:00
|
|
|
|
2008-06-06 02:20:16 +04:00
|
|
|
std::vector<std::string> SearchPaths;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::set<std::string> SearchPathsEmitted;
|
2008-01-17 17:02:31 +03:00
|
|
|
|
|
|
|
bool SearchFrameworkFirst;
|
|
|
|
bool SearchFrameworkOnly;
|
|
|
|
bool SearchFrameworkLast;
|
|
|
|
|
|
|
|
bool SearchAppBundleFirst;
|
|
|
|
bool SearchAppBundleOnly;
|
|
|
|
bool SearchAppBundleLast;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|