mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Search for CMake config files for pybind11. (#11423)
Summary: If pybind is build with cmake and installed, we should use config file instead of the Findpybind11 shipped with caffe2. Pull Request resolved: https://github.com/pytorch/pytorch/pull/11423 Differential Revision: D9735557 Pulled By: ezyang fbshipit-source-id: 28a39e579fa045060aa1a716e5fd7dbcf7b89569
This commit is contained in:
parent
02114e877f
commit
538ea67437
|
|
@ -412,7 +412,14 @@ if(BUILD_PYTHON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ---[ pybind11
|
# ---[ pybind11
|
||||||
find_package(pybind11)
|
find_package(pybind11 CONFIG)
|
||||||
|
if((DEFINED pybind11_DIR) AND pybind11_DIR)
|
||||||
|
get_target_property(pybind11_INCLUDE_DIRS pybind11::pybind11 INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
else()
|
||||||
|
message("pybind11 config not found. Fallback to legacy find.")
|
||||||
|
find_package(pybind11)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(pybind11_FOUND)
|
if(pybind11_FOUND)
|
||||||
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
|
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user