2016-09-27 19:01:08 +00: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 14:02:31 +00:00
|
|
|
#ifndef cmFindCommon_h
|
|
|
|
#define cmFindCommon_h
|
|
|
|
|
2017-08-25 18:39:02 +00:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-11-05 20:40:14 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
#include "cmCommand.h"
|
2014-10-17 17:07:26 +00:00
|
|
|
#include "cmPathLabel.h"
|
2016-04-29 14:53:13 +00:00
|
|
|
#include "cmSearchPath.h"
|
2008-01-17 14:02:31 +00: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();
|
2017-09-15 13:56:26 +00:00
|
|
|
~cmFindCommon() override;
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
protected:
|
2014-10-15 20:36:42 +00:00
|
|
|
friend class cmSearchPath;
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
/** Used to define groups of path labels */
|
|
|
|
class PathGroup : public cmPathLabel
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
PathGroup();
|
2016-05-16 14:34:04 +00:00
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
public:
|
2016-05-16 14:34:04 +00:00
|
|
|
PathGroup(const std::string& label)
|
|
|
|
: cmPathLabel(label)
|
|
|
|
{
|
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
static PathGroup All;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Individual path types */
|
|
|
|
class PathLabel : public cmPathLabel
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
PathLabel();
|
2016-05-16 14:34:04 +00:00
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
public:
|
2016-05-16 14:34:04 +00:00
|
|
|
PathLabel(const std::string& label)
|
|
|
|
: cmPathLabel(label)
|
|
|
|
{
|
|
|
|
}
|
2017-05-03 17:56:03 +00:00
|
|
|
static PathLabel PackageRoot;
|
2014-10-17 17:07:26 +00:00
|
|
|
static PathLabel CMake;
|
|
|
|
static PathLabel CMakeEnvironment;
|
|
|
|
static PathLabel Hints;
|
|
|
|
static PathLabel SystemEnvironment;
|
|
|
|
static PathLabel CMakeSystem;
|
|
|
|
static PathLabel Guess;
|
|
|
|
};
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
enum RootPathMode
|
|
|
|
{
|
|
|
|
RootPathModeNever,
|
|
|
|
RootPathModeOnly,
|
|
|
|
RootPathModeBoth
|
|
|
|
};
|
2014-10-09 17:52:54 +00:00
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
/** Construct the various path groups and labels */
|
|
|
|
void InitializeSearchPathGroups();
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
/** Place a set of search paths under the search roots. */
|
|
|
|
void RerootPaths(std::vector<std::string>& paths);
|
|
|
|
|
2010-08-12 22:20:47 +00:00
|
|
|
/** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables. */
|
|
|
|
void GetIgnoredPaths(std::vector<std::string>& ignore);
|
|
|
|
void GetIgnoredPaths(std::set<std::string>& ignore);
|
|
|
|
|
2011-09-23 18:27:25 +00:00
|
|
|
/** Compute final search path list (reroot + trailing slash). */
|
|
|
|
void ComputeFinalPaths();
|
2008-06-09 15:57:56 +00:00
|
|
|
|
2017-08-08 15:22:17 +00:00
|
|
|
/** Decide whether to enable the PACKAGE_ROOT search entries. */
|
|
|
|
void SelectDefaultNoPackageRootPath();
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
/** Compute the current default root path mode. */
|
|
|
|
void SelectDefaultRootPathMode();
|
|
|
|
|
|
|
|
/** Compute the current default bundle/framework search policy. */
|
|
|
|
void SelectDefaultMacMode();
|
|
|
|
|
2014-10-15 20:36:42 +00:00
|
|
|
// Path arguments prior to path manipulation routines
|
|
|
|
std::vector<std::string> UserHintsArgs;
|
|
|
|
std::vector<std::string> UserGuessArgs;
|
|
|
|
|
2014-02-10 05:21:34 +00:00
|
|
|
std::string CMakePathName;
|
2008-01-17 14:02:31 +00:00
|
|
|
RootPathMode FindRootPathMode;
|
|
|
|
|
|
|
|
bool CheckCommonArgument(std::string const& arg);
|
|
|
|
void AddPathSuffix(std::string const& arg);
|
2010-05-01 12:29:13 +00:00
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
bool NoDefaultPath;
|
2017-05-03 17:56:03 +00:00
|
|
|
bool NoPackageRootPath;
|
2008-01-17 14:02:31 +00:00
|
|
|
bool NoCMakePath;
|
|
|
|
bool NoCMakeEnvironmentPath;
|
|
|
|
bool NoSystemEnvironmentPath;
|
|
|
|
bool NoCMakeSystemPath;
|
|
|
|
|
|
|
|
std::vector<std::string> SearchPathSuffixes;
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2017-08-25 21:25:09 +00:00
|
|
|
std::map<PathGroup, std::vector<PathLabel>> PathGroupLabelMap;
|
2014-10-17 17:07:26 +00:00
|
|
|
std::vector<PathGroup> PathGroupOrder;
|
|
|
|
std::map<std::string, PathLabel> PathLabelStringMap;
|
|
|
|
std::map<PathLabel, cmSearchPath> LabeledPaths;
|
2014-10-09 17:52:54 +00:00
|
|
|
|
2008-06-05 22:20:16 +00:00
|
|
|
std::vector<std::string> SearchPaths;
|
2014-02-10 05:21:34 +00:00
|
|
|
std::set<std::string> SearchPathsEmitted;
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
bool SearchFrameworkFirst;
|
|
|
|
bool SearchFrameworkOnly;
|
|
|
|
bool SearchFrameworkLast;
|
|
|
|
|
|
|
|
bool SearchAppBundleFirst;
|
|
|
|
bool SearchAppBundleOnly;
|
|
|
|
bool SearchAppBundleLast;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|