depot/third_party/nixpkgs/pkgs/by-name/cm/cmake/000-nixpkgs-cmake-prefix-path.diff

29 lines
1.2 KiB
Diff
Raw Normal View History

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 8840cdcb..c34b7ee9 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -280,6 +280,11 @@ void cmFindBase::FillCMakeEnvironmentPath()
// Add CMAKE_*_PATH environment variables
std::string var = cmStrCat("CMAKE_", this->CMakePathName, "_PATH");
paths.AddEnvPrefixPath("CMAKE_PREFIX_PATH");
+ if (this->CMakePathName != "PROGRAM") {
+ // Like CMAKE_PREFIX_PATH except when searching for programs. Programs need
+ // to be located via PATH
+ paths.AddEnvPrefixPath("NIXPKGS_CMAKE_PREFIX_PATH");
+ }
paths.AddEnvPath(var);
if (this->CMakePathName == "PROGRAM") {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9b51b1ad..6acc676c 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -2039,6 +2039,7 @@ void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
// And now the general CMake environment variables
paths.AddEnvPath("CMAKE_PREFIX_PATH");
+ paths.AddEnvPath("NIXPKGS_CMAKE_PREFIX_PATH");
if (this->DebugMode) {
debugBuffer = cmStrCat(debugBuffer,
"CMAKE_PREFIX_PATH env variable "