diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-06-12 20:04:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-21 15:06:39 (GMT) |
commit | 02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f (patch) | |
tree | 91222ea7bb0386155dd7a4f673bf1164918ed5ea /Source | |
parent | f0a89149bc569020e281c5908733bf4b7eeddf15 (diff) | |
download | CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.zip CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.tar.gz CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.tar.bz2 |
Find: Provide global controls for the `NO_[]_PATH` call options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFindBase.cxx | 3 | ||||
-rw-r--r-- | Source/cmFindCommon.cxx | 21 | ||||
-rw-r--r-- | Source/cmFindCommon.h | 3 |
3 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index e590802..be7964a 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -67,6 +67,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) } this->AlreadyInCache = false; + // Find what search path locations have been enabled/disable + this->SelectDefaultSearchModes(); + // Find the current root path mode. this->SelectDefaultRootPathMode(); diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 954558f..c6b9049 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -3,6 +3,7 @@ #include "cmFindCommon.h" #include <algorithm> +#include <array> #include <string.h> #include <utility> @@ -144,6 +145,26 @@ void cmFindCommon::SelectDefaultMacMode() } } +void cmFindCommon::SelectDefaultSearchModes() +{ + const std::array<std::pair<bool&, std::string>, 5> search_paths = { + { { this->NoPackageRootPath, "CMAKE_FIND_USE_PACAKGE_ROOT_PATH" }, + { this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" }, + { this->NoCMakeEnvironmentPath, + "CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH" }, + { this->NoSystemEnvironmentPath, + "CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH" }, + { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" } } + }; + + for (auto& path : search_paths) { + const char* def = this->Makefile->GetDefinition(path.second); + if (def) { + path.first = !cmSystemTools::IsOn(def); + } + } +} + void cmFindCommon::RerootPaths(std::vector<std::string>& paths) { #if 0 diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 89ff174..d95eeb1 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -90,6 +90,9 @@ protected: /** Compute the current default bundle/framework search policy. */ void SelectDefaultMacMode(); + /** Compute the current default search modes based on global variables. */ + void SelectDefaultSearchModes(); + // Path arguments prior to path manipulation routines std::vector<std::string> UserHintsArgs; std::vector<std::string> UserGuessArgs; |