depot/third_party/nixpkgs/pkgs/development/python-modules/torch/0001-cmake.py-propagate-cmakeFlags-from-environment.patch

30 lines
994 B
Diff
Raw Normal View History

From c5d4087519eae6f41c80bbd8ffbcc9390db44c7f Mon Sep 17 00:00:00 2001
From: SomeoneSerge <else+aalto@someonex.net>
Date: Thu, 10 Oct 2024 19:19:18 +0000
Subject: [PATCH] cmake.py: propagate cmakeFlags from environment
---
tools/setup_helpers/cmake.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/setup_helpers/cmake.py b/tools/setup_helpers/cmake.py
index 4b605fe5975..ea1d6a1ef46 100644
--- a/tools/setup_helpers/cmake.py
+++ b/tools/setup_helpers/cmake.py
@@ -332,6 +332,12 @@ class CMake:
file=sys.stderr,
)
print(e, file=sys.stderr)
+
+ # Nixpkgs compat:
+ if "cmakeFlags" in os.environ:
+ import shlex
+ args.extend(shlex.split(os.environ["cmakeFlags"]))
+
# According to the CMake manual, we should pass the arguments first,
# and put the directory as the last element. Otherwise, these flags
# may not be passed correctly.
--
2.46.0