From 02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 12 Jun 2019 16:04:22 -0400 Subject: Find: Provide global controls for the `NO_[]_PATH` call options --- Source/cmFindCommon.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Source/cmFindCommon.cxx') diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 954558f4dc..c6b9049f41 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -3,6 +3,7 @@ #include "cmFindCommon.h" #include +#include #include #include @@ -144,6 +145,26 @@ void cmFindCommon::SelectDefaultMacMode() } } +void cmFindCommon::SelectDefaultSearchModes() +{ + const std::array, 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& paths) { #if 0 -- cgit v1.2.1