Skip to content

Commit fb77795

Browse files
committed
Enabled add_subdirectory() for xtensor dependency
1 parent 7f67a71 commit fb77795

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,20 @@ message(STATUS "xtensor-python v${${PROJECT_NAME}_VERSION}")
3232
# Dependencies
3333
# ============
3434

35-
find_package(xtl REQUIRED)
36-
message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl")
37-
find_package(xtensor REQUIRED)
38-
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
35+
set(xtensor_REQUIRED_VERSION 0.21.2)
36+
if(TARGET xtensor)
37+
set(xtensor_VERSION ${XTENSOR_VERSION_MAJOR}.${XTENSOR_VERSION_MINOR}.${XTENSOR_VERSION_PATCH})
38+
# Note: This is not SEMVER compatible comparison
39+
if( NOT ${xtensor_VERSION} VERSION_GREATER_EQUAL ${xtensor_REQUIRED_VERSION})
40+
message(ERROR "Mismatch xtensor versions. Found '${xtensor_VERSION}' but requires: '${xtensor_REQUIRED_VERSION}'")
41+
else()
42+
message(STATUS "Found xtensor v${xtensor_VERSION}")
43+
endif()
44+
else()
45+
find_package(xtensor ${xtensor_REQUIRED_VERSION} REQUIRED)
46+
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
47+
endif()
48+
3949
find_package(pybind11 REQUIRED)
4050
message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIRS}/pybind11")
4151
find_package(NumPy REQUIRED)

0 commit comments

Comments
 (0)