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
|
|
|
#include "cmFindCommon.h"
|
2016-04-29 13:40:20 +00:00
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <string.h>
|
|
|
|
#include <utility>
|
|
|
|
|
2016-10-25 18:35:04 +00:00
|
|
|
#include "cmMakefile.h"
|
2016-10-19 19:59:14 +00:00
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
|
2017-05-03 17:56:03 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::PackageRoot(
|
2017-07-11 12:15:21 +00:00
|
|
|
"PackageName_ROOT");
|
2014-10-17 17:07:26 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMake("CMAKE");
|
2016-05-16 14:34:04 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeEnvironment(
|
|
|
|
"CMAKE_ENVIRONMENT");
|
2014-10-17 17:07:26 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::Hints("HINTS");
|
2016-05-16 14:34:04 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::SystemEnvironment(
|
|
|
|
"SYSTM_ENVIRONMENT");
|
2014-10-17 17:07:26 +00:00
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeSystem("CMAKE_SYSTEM");
|
|
|
|
cmFindCommon::PathLabel cmFindCommon::PathLabel::Guess("GUESS");
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
cmFindCommon::cmFindCommon()
|
|
|
|
{
|
|
|
|
this->FindRootPathMode = RootPathModeBoth;
|
|
|
|
this->NoDefaultPath = false;
|
2017-05-03 17:56:03 +00:00
|
|
|
this->NoPackageRootPath = false;
|
2008-01-17 14:02:31 +00:00
|
|
|
this->NoCMakePath = false;
|
|
|
|
this->NoCMakeEnvironmentPath = false;
|
|
|
|
this->NoSystemEnvironmentPath = false;
|
|
|
|
this->NoCMakeSystemPath = false;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
// OS X Bundle and Framework search policy. The default is to
|
|
|
|
// search frameworks first on apple.
|
2008-01-17 14:02:31 +00:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
this->SearchFrameworkFirst = true;
|
|
|
|
this->SearchAppBundleFirst = true;
|
|
|
|
#else
|
|
|
|
this->SearchFrameworkFirst = false;
|
|
|
|
this->SearchAppBundleFirst = false;
|
|
|
|
#endif
|
|
|
|
this->SearchFrameworkOnly = false;
|
|
|
|
this->SearchFrameworkLast = false;
|
|
|
|
this->SearchAppBundleOnly = false;
|
|
|
|
this->SearchAppBundleLast = false;
|
2014-10-17 17:07:26 +00:00
|
|
|
|
|
|
|
this->InitializeSearchPathGroups();
|
2010-11-12 15:47:28 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2019-01-22 22:44:50 +00:00
|
|
|
cmFindCommon::~cmFindCommon() = default;
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2014-10-17 17:07:26 +00:00
|
|
|
void cmFindCommon::InitializeSearchPathGroups()
|
|
|
|
{
|
|
|
|
std::vector<PathLabel>* labels;
|
|
|
|
|
2018-06-04 05:48:39 +00:00
|
|
|
// Define the various different groups of path types
|
2014-10-17 17:07:26 +00:00
|
|
|
|
|
|
|
// All search paths
|
|
|
|
labels = &this->PathGroupLabelMap[PathGroup::All];
|
2017-05-03 17:56:03 +00:00
|
|
|
labels->push_back(PathLabel::PackageRoot);
|
2014-10-17 17:07:26 +00:00
|
|
|
labels->push_back(PathLabel::CMake);
|
|
|
|
labels->push_back(PathLabel::CMakeEnvironment);
|
|
|
|
labels->push_back(PathLabel::Hints);
|
|
|
|
labels->push_back(PathLabel::SystemEnvironment);
|
|
|
|
labels->push_back(PathLabel::CMakeSystem);
|
|
|
|
labels->push_back(PathLabel::Guess);
|
|
|
|
|
|
|
|
// Define the search group order
|
|
|
|
this->PathGroupOrder.push_back(PathGroup::All);
|
|
|
|
|
2018-06-04 05:48:39 +00:00
|
|
|
// Create the individual labeled search paths
|
2017-05-03 17:56:03 +00:00
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::PackageRoot, cmSearchPath(this)));
|
2016-05-16 14:34:04 +00:00
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::CMake, cmSearchPath(this)));
|
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::CMakeEnvironment, cmSearchPath(this)));
|
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::Hints, cmSearchPath(this)));
|
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::SystemEnvironment, cmSearchPath(this)));
|
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::CMakeSystem, cmSearchPath(this)));
|
|
|
|
this->LabeledPaths.insert(
|
|
|
|
std::make_pair(PathLabel::Guess, cmSearchPath(this)));
|
2014-10-17 17:07:26 +00:00
|
|
|
}
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
void cmFindCommon::SelectDefaultRootPathMode()
|
|
|
|
{
|
|
|
|
// Check the policy variable for this find command type.
|
|
|
|
std::string findRootPathVar = "CMAKE_FIND_ROOT_PATH_MODE_";
|
|
|
|
findRootPathVar += this->CMakePathName;
|
|
|
|
std::string rootPathMode =
|
2014-03-10 23:04:11 +00:00
|
|
|
this->Makefile->GetSafeDefinition(findRootPathVar);
|
2016-05-16 14:34:04 +00:00
|
|
|
if (rootPathMode == "NEVER") {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->FindRootPathMode = RootPathModeNever;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (rootPathMode == "ONLY") {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->FindRootPathMode = RootPathModeOnly;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (rootPathMode == "BOTH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->FindRootPathMode = RootPathModeBoth;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmFindCommon::SelectDefaultMacMode()
|
|
|
|
{
|
|
|
|
std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK");
|
2016-05-16 14:34:04 +00:00
|
|
|
if (ff == "NEVER") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchFrameworkLast = false;
|
|
|
|
this->SearchFrameworkFirst = false;
|
|
|
|
this->SearchFrameworkOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (ff == "ONLY") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchFrameworkLast = false;
|
|
|
|
this->SearchFrameworkFirst = false;
|
|
|
|
this->SearchFrameworkOnly = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (ff == "FIRST") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchFrameworkLast = false;
|
|
|
|
this->SearchFrameworkFirst = true;
|
|
|
|
this->SearchFrameworkOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (ff == "LAST") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchFrameworkLast = true;
|
|
|
|
this->SearchFrameworkFirst = false;
|
|
|
|
this->SearchFrameworkOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
std::string fab = this->Makefile->GetSafeDefinition("CMAKE_FIND_APPBUNDLE");
|
2016-05-16 14:34:04 +00:00
|
|
|
if (fab == "NEVER") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchAppBundleLast = false;
|
|
|
|
this->SearchAppBundleFirst = false;
|
|
|
|
this->SearchAppBundleOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (fab == "ONLY") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchAppBundleLast = false;
|
|
|
|
this->SearchAppBundleFirst = false;
|
|
|
|
this->SearchAppBundleOnly = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (fab == "FIRST") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchAppBundleLast = false;
|
|
|
|
this->SearchAppBundleFirst = true;
|
|
|
|
this->SearchAppBundleOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (fab == "LAST") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->SearchAppBundleLast = true;
|
|
|
|
this->SearchAppBundleFirst = false;
|
|
|
|
this->SearchAppBundleOnly = false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
|
|
|
|
{
|
|
|
|
#if 0
|
2017-09-11 10:40:26 +00:00
|
|
|
for(std::string const& p : paths)
|
2008-01-17 14:02:31 +00:00
|
|
|
{
|
2017-09-11 10:40:26 +00:00
|
|
|
fprintf(stderr, "[%s]\n", p.c_str());
|
2008-01-17 14:02:31 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Short-circuit if there is nothing to do.
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->FindRootPathMode == RootPathModeNever) {
|
2008-01-17 14:02:31 +00:00
|
|
|
return;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-17 17:07:26 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* sysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
|
2017-05-09 18:08:15 +00:00
|
|
|
const char* sysrootCompile =
|
|
|
|
this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE");
|
|
|
|
const char* sysrootLink =
|
|
|
|
this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK");
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
|
2013-04-13 12:46:57 +00:00
|
|
|
const bool noSysroot = !sysroot || !*sysroot;
|
2017-05-09 18:08:15 +00:00
|
|
|
const bool noCompileSysroot = !sysrootCompile || !*sysrootCompile;
|
|
|
|
const bool noLinkSysroot = !sysrootLink || !*sysrootLink;
|
2013-04-13 12:46:57 +00:00
|
|
|
const bool noRootPath = !rootPath || !*rootPath;
|
2017-05-09 18:08:15 +00:00
|
|
|
if (noSysroot && noCompileSysroot && noLinkSysroot && noRootPath) {
|
2008-01-17 14:02:31 +00:00
|
|
|
return;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
// Construct the list of path roots with no trailing slashes.
|
|
|
|
std::vector<std::string> roots;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (rootPath) {
|
2013-04-13 12:46:57 +00:00
|
|
|
cmSystemTools::ExpandListArgument(rootPath, roots);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2017-05-09 18:08:15 +00:00
|
|
|
if (sysrootCompile) {
|
2019-01-16 06:13:07 +00:00
|
|
|
roots.emplace_back(sysrootCompile);
|
2017-05-09 18:08:15 +00:00
|
|
|
}
|
|
|
|
if (sysrootLink) {
|
2019-01-16 06:13:07 +00:00
|
|
|
roots.emplace_back(sysrootLink);
|
2017-05-09 18:08:15 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
if (sysroot) {
|
2019-01-16 06:13:07 +00:00
|
|
|
roots.emplace_back(sysroot);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2017-09-11 10:40:26 +00:00
|
|
|
for (std::string& r : roots) {
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(r);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
2013-11-14 11:04:40 +00:00
|
|
|
const char* stagePrefix =
|
2016-05-16 14:34:04 +00:00
|
|
|
this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
|
2013-11-14 11:04:40 +00:00
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
// Copy the original set of unrooted paths.
|
|
|
|
std::vector<std::string> unrootedPaths = paths;
|
|
|
|
paths.clear();
|
|
|
|
|
2017-09-11 10:40:26 +00:00
|
|
|
for (std::string const& r : roots) {
|
|
|
|
for (std::string const& up : unrootedPaths) {
|
2008-01-17 14:02:31 +00:00
|
|
|
// Place the unrooted path under the current root if it is not
|
|
|
|
// already inside. Skip the unrooted path if it is relative to
|
|
|
|
// a user home directory or is empty.
|
|
|
|
std::string rootedDir;
|
2017-09-11 10:40:26 +00:00
|
|
|
if (cmSystemTools::IsSubDirectory(up, r) ||
|
|
|
|
(stagePrefix && cmSystemTools::IsSubDirectory(up, stagePrefix))) {
|
|
|
|
rootedDir = up;
|
|
|
|
} else if (!up.empty() && up[0] != '~') {
|
2008-01-17 14:02:31 +00:00
|
|
|
// Start with the new root.
|
2017-09-11 10:40:26 +00:00
|
|
|
rootedDir = r;
|
2008-01-17 14:02:31 +00:00
|
|
|
rootedDir += "/";
|
|
|
|
|
|
|
|
// Append the original path with its old root removed.
|
2017-09-11 10:40:26 +00:00
|
|
|
rootedDir += cmSystemTools::SplitPathRootComponent(up);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
// Store the new path.
|
|
|
|
paths.push_back(rootedDir);
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
// If searching both rooted and unrooted paths add the original
|
|
|
|
// paths again.
|
2016-05-16 14:34:04 +00:00
|
|
|
if (this->FindRootPathMode == RootPathModeBoth) {
|
2008-01-17 14:02:31 +00:00
|
|
|
paths.insert(paths.end(), unrootedPaths.begin(), unrootedPaths.end());
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
}
|
|
|
|
|
2010-08-12 22:20:47 +00:00
|
|
|
void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
|
|
|
|
{
|
|
|
|
// null-terminated list of paths.
|
2016-05-16 14:34:04 +00:00
|
|
|
static const char* paths[] = { "CMAKE_SYSTEM_IGNORE_PATH",
|
2017-08-22 21:42:36 +00:00
|
|
|
"CMAKE_IGNORE_PATH", nullptr };
|
2010-08-12 22:20:47 +00:00
|
|
|
|
|
|
|
// Construct the list of path roots with no trailing slashes.
|
2016-05-16 14:34:04 +00:00
|
|
|
for (const char** pathName = paths; *pathName; ++pathName) {
|
2010-08-12 22:20:47 +00:00
|
|
|
// Get the list of paths to ignore from the variable.
|
|
|
|
const char* ignorePath = this->Makefile->GetDefinition(*pathName);
|
2017-08-22 21:42:36 +00:00
|
|
|
if ((ignorePath == nullptr) || (strlen(ignorePath) == 0)) {
|
2010-08-12 22:20:47 +00:00
|
|
|
continue;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2010-08-12 22:20:47 +00:00
|
|
|
|
|
|
|
cmSystemTools::ExpandListArgument(ignorePath, ignore);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2010-08-12 22:20:47 +00:00
|
|
|
|
2017-09-11 10:40:26 +00:00
|
|
|
for (std::string& i : ignore) {
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(i);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2010-08-12 22:20:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmFindCommon::GetIgnoredPaths(std::set<std::string>& ignore)
|
|
|
|
{
|
|
|
|
std::vector<std::string> ignoreVec;
|
|
|
|
GetIgnoredPaths(ignoreVec);
|
|
|
|
ignore.insert(ignoreVec.begin(), ignoreVec.end());
|
|
|
|
}
|
|
|
|
|
2008-01-17 14:02:31 +00:00
|
|
|
bool cmFindCommon::CheckCommonArgument(std::string const& arg)
|
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (arg == "NO_DEFAULT_PATH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->NoDefaultPath = true;
|
2017-05-03 17:56:03 +00:00
|
|
|
} else if (arg == "NO_PACKAGE_ROOT_PATH") {
|
|
|
|
this->NoPackageRootPath = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "NO_CMAKE_PATH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->NoCMakePath = true;
|
2017-05-03 17:56:03 +00:00
|
|
|
} else if (arg == "NO_CMAKE_ENVIRONMENT_PATH") {
|
|
|
|
this->NoCMakeEnvironmentPath = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "NO_SYSTEM_ENVIRONMENT_PATH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->NoSystemEnvironmentPath = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "NO_CMAKE_SYSTEM_PATH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->NoCMakeSystemPath = true;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "NO_CMAKE_FIND_ROOT_PATH") {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->FindRootPathMode = RootPathModeNever;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "ONLY_CMAKE_FIND_ROOT_PATH") {
|
2014-10-15 20:36:42 +00:00
|
|
|
this->FindRootPathMode = RootPathModeOnly;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (arg == "CMAKE_FIND_ROOT_PATH_BOTH") {
|
2008-01-17 14:02:31 +00:00
|
|
|
this->FindRootPathMode = RootPathModeBoth;
|
2016-05-16 14:34:04 +00:00
|
|
|
} else {
|
2008-01-17 14:02:31 +00:00
|
|
|
// The argument is not one of the above.
|
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
// The argument is one of the above.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmFindCommon::AddPathSuffix(std::string const& arg)
|
|
|
|
{
|
|
|
|
std::string suffix = arg;
|
|
|
|
|
|
|
|
// Strip leading and trailing slashes.
|
2016-05-16 14:34:04 +00:00
|
|
|
if (suffix.empty()) {
|
2008-01-17 14:02:31 +00:00
|
|
|
return;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2018-11-06 06:47:40 +00:00
|
|
|
if (suffix.front() == '/') {
|
2017-05-30 19:46:05 +00:00
|
|
|
suffix = suffix.substr(1);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
|
|
|
if (suffix.empty()) {
|
2008-01-17 14:02:31 +00:00
|
|
|
return;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2018-11-06 06:47:40 +00:00
|
|
|
if (suffix.back() == '/') {
|
2016-05-16 14:34:04 +00:00
|
|
|
suffix = suffix.substr(0, suffix.size() - 1);
|
|
|
|
}
|
|
|
|
if (suffix.empty()) {
|
2008-01-17 14:02:31 +00:00
|
|
|
return;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2008-01-17 14:02:31 +00:00
|
|
|
|
|
|
|
// Store the suffix.
|
2018-01-25 13:59:33 +00:00
|
|
|
this->SearchPathSuffixes.push_back(std::move(suffix));
|
2008-01-17 14:02:31 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 17:52:54 +00:00
|
|
|
void AddTrailingSlash(std::string& s)
|
|
|
|
{
|
2019-02-04 21:56:42 +00:00
|
|
|
if (!s.empty() && s.back() != '/') {
|
2014-10-09 17:52:54 +00:00
|
|
|
s += '/';
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-10-09 17:52:54 +00:00
|
|
|
}
|
2011-09-23 18:27:25 +00:00
|
|
|
void cmFindCommon::ComputeFinalPaths()
|
2008-06-09 15:57:56 +00:00
|
|
|
{
|
2014-10-09 17:52:54 +00:00
|
|
|
// Filter out ignored paths from the prefix list
|
|
|
|
std::set<std::string> ignored;
|
|
|
|
this->GetIgnoredPaths(ignored);
|
|
|
|
|
2017-11-02 23:14:55 +00:00
|
|
|
// Combine the separate path types, filtering out ignores
|
2014-10-17 17:07:26 +00:00
|
|
|
this->SearchPaths.clear();
|
|
|
|
std::vector<PathLabel>& allLabels = this->PathGroupLabelMap[PathGroup::All];
|
2017-09-11 10:40:26 +00:00
|
|
|
for (PathLabel const& l : allLabels) {
|
|
|
|
this->LabeledPaths[l].ExtractWithout(ignored, this->SearchPaths);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2011-09-23 18:27:25 +00:00
|
|
|
|
|
|
|
// Expand list of paths inside all search roots.
|
2014-10-09 17:52:54 +00:00
|
|
|
this->RerootPaths(this->SearchPaths);
|
2011-09-23 18:27:25 +00:00
|
|
|
|
2008-06-09 15:57:56 +00:00
|
|
|
// Add a trailing slash to all paths to aid the search process.
|
2014-10-09 17:52:54 +00:00
|
|
|
std::for_each(this->SearchPaths.begin(), this->SearchPaths.end(),
|
|
|
|
&AddTrailingSlash);
|
2008-06-09 15:57:56 +00:00
|
|
|
}
|