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
|
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
|
|
|
#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
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
class cmMakefile;
|
|
|
|
|
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();
|
2016-06-27 19:25:27 +00:00
|
|
|
~cmFindCommon() CM_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)
|
|
|
|
{
|
|
|
|
}
|
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);
|
|
|
|
|
|
|
|
/** Remove paths in the ignore set from the supplied vector. */
|
2014-10-09 17:52:54 +00:00
|
|
|
void FilterPaths(const std::vector<std::string>& inPaths,
|
|
|
|
const std::set<std::string>& ignore,
|
|
|
|
std::vector<std::string>& outPaths);
|
2010-08-12 22:20:47 +00:00
|
|
|
|
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
|
|
|
|
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
|
|
|
void SetMakefile(cmMakefile* makefile);
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
bool NoDefaultPath;
|
|
|
|
bool NoCMakePath;
|
|
|
|
bool NoCMakeEnvironmentPath;
|
|
|
|
bool NoSystemEnvironmentPath;
|
|
|
|
bool NoCMakeSystemPath;
|
|
|
|
|
|
|
|
std::vector<std::string> SearchPathSuffixes;
|
2014-10-17 17:07:26 +00: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 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
|