@@ -51,7 +51,7 @@ endif()
5151# Cf. https://github.com/pybind/pybind11/issues/2268
5252#find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED)
5353# the above line uses a deprecated cmake method, use the following instead
54- find_package (Python COMPONENTS Interpreter REQUIRED)
54+ find_package (Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
5555
5656set (pybind11_REQUIRED_VERSION 2.6.1)
5757if (TARGET pybind11 OR TARGET pybind11::headers)
@@ -62,12 +62,6 @@ else()
6262 message (STATUS "Found pybind11: ${pybind11_INCLUDE_DIRS} /pybind11" )
6363endif ()
6464
65- # Look for NumPy headers, except if NUMPY_INCLUDE_DIRS is passed,
66- # which is required under some circumstances (such as wasm, where
67- # there is no real python executable)
68- if (NOT Python_NumPy_INCLUDE_DIR)
69- find_package (NumPy REQUIRED)
70- endif ()
7165message (STATUS "Found numpy: ${Python_NumPy_INCLUDE_DIR} " )
7266
7367# Build
@@ -87,7 +81,7 @@ set(XTENSOR_PYTHON_HEADERS
8781
8882add_library (xtensor-python INTERFACE )
8983target_include_directories (xtensor-python INTERFACE
90- "$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR} ;${pybind11_INCLUDE_DIRS} ;${NUMPY_INCLUDE_DIRS } >"
84+ "$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR} ;${pybind11_INCLUDE_DIRS} ;${Python_NumPy_INCLUDE_DIR } >"
9185 $<INSTALL_INTERFACE:include >)
9286target_link_libraries (xtensor-python INTERFACE xtensor)
9387get_target_property (inc_dir xtensor-python INTERFACE_INCLUDE_DIRECTORIES )
0 commit comments