diff options
author | Brad King <brad.king@kitware.com> | 2016-03-14 14:38:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-03-16 13:03:26 (GMT) |
commit | 3144857e1eed83e038699942568869bfce461d4d (patch) | |
tree | 308a88383bed0e65d0bae865ed84e8d1fdd5f092 /Source/cmMakefile.cxx | |
parent | a87253154e15da3f05ec7a4c625caaa0c54a3861 (diff) | |
download | CMake-3144857e1eed83e038699942568869bfce461d4d.zip CMake-3144857e1eed83e038699942568869bfce461d4d.tar.gz CMake-3144857e1eed83e038699942568869bfce461d4d.tar.bz2 |
Avoid depending on CMAKE_ROOT cache entry internally (#16015)
Use cmSystemTools::GetCMakeRoot() which always knows the location of our
resources. Do not depend on CMAKE_ROOT because the user could unset it
from the cache.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8f59e2c..1df5cec 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3738,17 +3738,13 @@ std::string cmMakefile::GetModulesFile(const char* filename) const } // Always search in the standard modules location. - const char* cmakeRoot = this->GetDefinition("CMAKE_ROOT"); - if(cmakeRoot) - { - moduleInCMakeRoot = cmakeRoot; - moduleInCMakeRoot += "/Modules/"; - moduleInCMakeRoot += filename; - cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot); - if(!cmSystemTools::FileExists(moduleInCMakeRoot.c_str())) - { - moduleInCMakeRoot = ""; - } + moduleInCMakeRoot = cmSystemTools::GetCMakeRoot(); + moduleInCMakeRoot += "/Modules/"; + moduleInCMakeRoot += filename; + cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot); + if(!cmSystemTools::FileExists(moduleInCMakeRoot.c_str())) + { + moduleInCMakeRoot = ""; } // Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file @@ -3763,7 +3759,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) { const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE"); - std::string mods = cmakeRoot + std::string("/Modules/"); + std::string mods = cmSystemTools::GetCMakeRoot() + "/Modules/"; if (currentFile && strncmp(currentFile, mods.c_str(), mods.size()) == 0) { switch (this->GetPolicyStatus(cmPolicies::CMP0017)) |