summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-21 15:06:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-06-21 15:07:56 (GMT)
commit12c65a52bd3c8eee564cf766a260b98602942a5f (patch)
treeb8c647c9b3efcdc37ff19f43fdefc9b3e93995e7 /Source
parent512013e276e66551c19c12af01336f96c26965a5 (diff)
parent02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f (diff)
downloadCMake-12c65a52bd3c8eee564cf766a260b98602942a5f.zip
CMake-12c65a52bd3c8eee564cf766a260b98602942a5f.tar.gz
CMake-12c65a52bd3c8eee564cf766a260b98602942a5f.tar.bz2
Merge topic 'find-control-vars'
02f527c66a Find: Provide global controls for the `NO_[]_PATH` call options f0a89149bc RunCMake: Automatically support platform out override files Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3444
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFindBase.cxx3
-rw-r--r--Source/cmFindCommon.cxx21
-rw-r--r--Source/cmFindCommon.h3
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;