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,11 +412,18 @@ if(BUILD_PYTHON)
|
|||
endif()
|
||||
|
||||
# ---[ pybind11
|
||||
find_package(pybind11)
|
||||
if(pybind11_FOUND)
|
||||
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
|
||||
find_package(pybind11 CONFIG)
|
||||
if((DEFINED pybind11_DIR) AND pybind11_DIR)
|
||||
get_target_property(pybind11_INCLUDE_DIRS pybind11::pybind11 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
else()
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/pybind11/include)
|
||||
message("pybind11 config not found. Fallback to legacy find.")
|
||||
find_package(pybind11)
|
||||
endif()
|
||||
|
||||
if(pybind11_FOUND)
|
||||
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
|
||||
else()
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/pybind11/include)
|
||||
endif()
|
||||
|
||||
# ---[ MPI
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user