mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 03:12:51 +00:00
8c9c8ade2f
patch cmake to implement a NIXPKGS_CMAKE_PREFIX_PATH env variable which is similar to CMAKE_PREFIX_PATH except it is not searched for programs. This is required because cmake will search CMAKE_PREFIX_PATH for programs before PATH which is problematic as that means buildInputs gets searched before nativeBuildInputs which can break things when the binaries in PATH are covered or the order re-arranged.
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
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 "
|