Skip to content

Commit c72040e

Browse files
committed
fix cmakelists
1 parent 1d0bd68 commit c72040e

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,25 @@ endif()
3535
# ────────────────────────────────────────────
3636
# Dependencies
3737
# ────────────────────────────────────────────
38-
# nanobind (requires Python to be located first; pybind11 used to do this internally)
39-
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
38+
# nanobind (requires Python to be located first; pybind11 used to do this
39+
# internally)
40+
find_package(
41+
Python
42+
COMPONENTS Interpreter Development.Module
43+
REQUIRED)
44+
# Nanobind ships its CMake config inside site-packages/nanobind/cmake, so
45+
# find_package() can't discover it unless we set it. (scikit-build-core does
46+
# this as well)
47+
if(NOT nanobind_ROOT)
48+
execute_process(
49+
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
50+
OUTPUT_STRIP_TRAILING_WHITESPACE
51+
OUTPUT_VARIABLE nanobind_ROOT)
52+
endif()
4053
find_package(nanobind CONFIG REQUIRED)
41-
# Build nanobind's core support library up front so the object libraries below (which include
42-
# nanobind headers via the umbrella) compile against its include dirs + Python headers + flags.
54+
# Build nanobind's core support library up front so the object libraries below
55+
# (which include nanobind headers via the umbrella) compile against its include
56+
# dirs + Python headers + flags.
4357
nanobind_build_library(nanobind-static)
4458

4559
# DuckDB

0 commit comments

Comments
 (0)