diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-08-30 19:27:30 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-08-30 21:52:40 (GMT) |
commit | 0fc10bb19bd63ca9f6647a7b373e91fb16403249 (patch) | |
tree | 942b69b1cd977e8d7ee67d96cc17827422cf5eb9 /Source/cmFindBase.cxx | |
parent | 43d31c519882f63456eafcaa2bd5c1bfc4e2ef1f (diff) | |
download | CMake-0fc10bb19bd63ca9f6647a7b373e91fb16403249.zip CMake-0fc10bb19bd63ca9f6647a7b373e91fb16403249.tar.gz CMake-0fc10bb19bd63ca9f6647a7b373e91fb16403249.tar.bz2 |
CMAKE_FIND_USE_INSTALL_PREFIX considers CMAKE_STAGING_PREFIX
Fixes #23900
Diffstat (limited to 'Source/cmFindBase.cxx')
-rw-r--r-- | Source/cmFindBase.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 896c5d2..1da995a 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -278,13 +278,11 @@ void cmFindBase::FillSystemEnvironmentPath() paths.AddSuffixes(this->SearchPathSuffixes); } -#include <iostream> namespace { struct entry_to_remove { - entry_to_remove(std::string name, cmMakefile* makefile) - : count(-1) - , value() + entry_to_remove(std::string const& name, cmMakefile* makefile) + : value() { if (cmValue to_skip = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) { @@ -312,7 +310,7 @@ struct entry_to_remove } } - long count; + long count = -1; std::string value; }; } @@ -339,20 +337,23 @@ void cmFindBase::FillCMakeSystemVariablePath() // have removed `CMAKE_INSTALL_PREFIX` from the list, we don't remove // some other entry by mistake ( likewise for `CMAKE_STAGING_PREFIX` ) entry_to_remove install_entry("INSTALL", this->Makefile); + entry_to_remove staging_entry("STAGING", this->Makefile); if (remove_install_prefix && install_prefix_in_list && - install_entry.valid()) { + (install_entry.valid() || staging_entry.valid())) { cmValue prefix_paths = this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH"); // remove entries from CMAKE_SYSTEM_PREFIX_PATH std::vector<std::string> expanded = cmExpandedList(*prefix_paths); install_entry.remove_self(expanded); + staging_entry.remove_self(expanded); paths.AddPrefixPaths(expanded, this->Makefile->GetCurrentSourceDirectory().c_str()); } else if (add_install_prefix && !install_prefix_in_list) { paths.AddCMakePrefixPath("CMAKE_INSTALL_PREFIX"); + paths.AddCMakePrefixPath("CMAKE_STAGING_PREFIX"); paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); } else { // Otherwise the current setup of `CMAKE_SYSTEM_PREFIX_PATH` is correct |