When looking for pybind11, do not attempt to get properties from pybind11:pybind11. (#12188)

Summary:
There is no property name "INTERFACE_INCLUDE_DIRECTORIES" for pybind11::pybind11. This will cause cmake error if there exists a system installation of pybind11. In addition, pybind11_INCLUDE_DIRS is already set once "find_package(pybind11 CONFIG)" finds pybind11.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12188

Differential Revision: D10362655

Pulled By: soumith

fbshipit-source-id: 9c5d13295c4a2cf9aacd03e195994287d06ed15c
This commit is contained in:
Hong Xu 2018-10-31 11:21:05 -07:00 committed by Facebook Github Bot
parent f5b34e3446
commit a43c6385f1

View File

@ -485,15 +485,13 @@ endif()
# ---[ pybind11
find_package(pybind11 CONFIG)
if((DEFINED pybind11_DIR) AND pybind11_DIR)
get_target_property(pybind11_INCLUDE_DIRS pybind11::pybind11 INTERFACE_INCLUDE_DIRECTORIES)
else()
if(NOT pybind11_FOUND)
find_package(pybind11)
endif()
if(pybind11_FOUND)
message(STATUS "System pybind11 found")
message(STATUS "pybind11l include dirs: " ${pybind11_INCLUDE_DIRS})
message(STATUS "pybind11 include dirs: " "${pybind11_INCLUDE_DIRS}")
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
else()
message(STATUS "Using third_party/pybind11.")