Skip to content

Commit 6146a85

Browse files
snnnhouseroad
authored andcommitted
Check pybind version (onnx#1315)
1 parent 2cbf740 commit 6146a85

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CMakeLists.txt

+8-4
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,18 @@ if(BUILD_ONNX_PYTHON)
305305
"${PYTHON_INCLUDE_DIR}")
306306

307307
# pybind11 is a header only lib
308-
find_package(pybind11)
308+
find_package(pybind11 2.2)
309309
if(pybind11_FOUND)
310310
target_include_directories(onnx_cpp2py_export
311311
PRIVATE ${pybind11_INCLUDE_DIRS})
312312
else()
313-
target_include_directories(
314-
onnx_cpp2py_export
315-
PRIVATE ${ONNX_ROOT}/third_party/pybind11/include)
313+
if(EXISTS ${ONNX_ROOT}/third_party/pybind11/include/pybind11/pybind11.h)
314+
target_include_directories(
315+
onnx_cpp2py_export
316+
PRIVATE ${ONNX_ROOT}/third_party/pybind11/include)
317+
else()
318+
message(FATAL_ERROR "cannot find pybind")
319+
endif()
316320
endif()
317321

318322
if(APPLE)

0 commit comments

Comments
 (0)