1010cmake_minimum_required (VERSION 3.29 )
1111project (xtensor-python)
1212
13- set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR } /cmake ${CMAKE_MODULE_PATH } )
1413set (XTENSOR_PYTHON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR } /include)
1514
1615# Versioning
4645 message (STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS} /xtensor" )
4746endif ()
4847
49- find_package (Python COMPONENTS Interpreter REQUIRED )
48+ find_package (Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED )
5049
5150set (pybind11_REQUIRED_VERSION 3.0.0)
5251if (NOT TARGET pybind11::headers)
@@ -60,14 +59,6 @@ else ()
6059 message (STATUS "Found pybind11 v${pybind11_VERSION} " )
6160endif ()
6261
63- # Look for NumPy headers, except if NUMPY_INCLUDE_DIRS is passed,
64- # which is required under some circumstances (such as wasm, where
65- # there is no real python executable)
66- if (NOT NUMPY_INCLUDE_DIRS)
67- find_package (NumPy REQUIRED )
68- endif ()
69- message (STATUS "Found numpy: ${NUMPY_INCLUDE_DIRS} " )
70-
7162# Build
7263# =====
7364
@@ -84,10 +75,8 @@ set(XTENSOR_PYTHON_HEADERS
8475 )
8576
8677add_library (xtensor-python INTERFACE )
87- target_include_directories (xtensor-python INTERFACE
88- "$<BUILD_INTERFACE :${XTENSOR_PYTHON_INCLUDE_DIR} ;${pybind11_INCLUDE_DIRS} ;${NUMPY_INCLUDE_DIRS} >"
89- $<INSTALL_INTERFACE :include >)
90- target_link_libraries (xtensor-python INTERFACE xtensor )
78+ target_include_directories (xtensor-python INTERFACE "$<BUILD_INTERFACE :${XTENSOR_PYTHON_INCLUDE_DIR} >" $<INSTALL_INTERFACE :include >)
79+ target_link_libraries (xtensor-python INTERFACE xtensor pybind11::pybind11 Python3::NumPy )
9180get_target_property (inc_dir xtensor-python INTERFACE_INCLUDE_DIRECTORIES )
9281
9382OPTION (BUILD_TESTS "xtensor test suite" OFF )
0 commit comments