fix(setup): support overriding CMake args (#3577)

* fix: support conda-forge

* Update setup.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner 2022-01-31 11:38:06 -05:00 committed by GitHub
parent dc4717bac2
commit bf7e5f9284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,6 +146,13 @@ with remove_output("pybind11/include", "pybind11/share"):
"-DBUILD_TESTING=OFF", "-DBUILD_TESTING=OFF",
"-DPYBIND11_NOPYTHON=ON", "-DPYBIND11_NOPYTHON=ON",
] ]
if "CMAKE_ARGS" in os.environ:
fcommand = [
c
for c in os.environ["CMAKE_ARGS"].split()
if "DCMAKE_INSTALL_PREFIX" not in c
]
cmd += fcommand
cmake_opts = dict(cwd=DIR, stdout=sys.stdout, stderr=sys.stderr) cmake_opts = dict(cwd=DIR, stdout=sys.stdout, stderr=sys.stderr)
subprocess.check_call(cmd, **cmake_opts) subprocess.check_call(cmd, **cmake_opts)
subprocess.check_call(["cmake", "--install", tmpdir], **cmake_opts) subprocess.check_call(["cmake", "--install", tmpdir], **cmake_opts)