|
| 1 | +# pybind11Config.cmake |
| 2 | +# -------------------- |
| 3 | +# |
| 4 | +# PYBIND11 cmake module. |
| 5 | +# This module sets the following variables in your project: |
| 6 | +# |
| 7 | +# :: |
| 8 | +# |
| 9 | +# pybind11_FOUND - true if pybind11 and all required components found on the system |
| 10 | +# pybind11_VERSION - pybind11 version in format Major.Minor.Release |
| 11 | +# pybind11_INCLUDE_DIRS - Directory where pybind11 headers are located. |
| 12 | +# pybind11_INCLUDE_DIR - same as DIRS |
| 13 | +# |
| 14 | +# |
| 15 | +# Available components: None |
| 16 | +# |
| 17 | +# |
| 18 | +# Exported targets: |
| 19 | +# |
| 20 | +# :: |
| 21 | +# |
| 22 | +# If pybind11 is found, this module defines the following :prop_tgt:`IMPORTED` |
| 23 | +# target. Note that python headers and C++ standard (11 or 14) of your choice and |
| 24 | +# detection will need to be applied to your code :: |
| 25 | +# |
| 26 | +# pybind11::pybind11 - the main pybind11 interface library (i.e., headers) |
| 27 | +# |
| 28 | +# find_package(PythonLibsNew REQUIRED) |
| 29 | +# find_package(pybind11 CONFIG REQUIRED) |
| 30 | +# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION})") |
| 31 | +# set_property(TARGET pybind11::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS} |
| 32 | +# INTERFACE_COMPILE_OPTIONS "-std=c++11") |
| 33 | +# |
| 34 | +# |
| 35 | +# Suggested usage: |
| 36 | +# |
| 37 | +# :: |
| 38 | +# |
| 39 | +# find_package(pybind11) |
| 40 | +# find_package(pybind11 2.0 EXACT CONFIG REQUIRED) |
| 41 | +# |
| 42 | +# |
| 43 | +# The following variables can be set to guide the search for this package: |
| 44 | +# |
| 45 | +# :: |
| 46 | +# |
| 47 | +# pybind11_DIR - CMake variable, set to directory containing this Config file |
| 48 | +# CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package |
| 49 | +# PATH - environment variable, set to bin directory of this package |
| 50 | +# CMAKE_DISABLE_FIND_PACKAGE_pybind11 - CMake variable, disables |
| 51 | +# find_package(pybind11) when not REQUIRED, perhaps to force internal build |
| 52 | + |
| 53 | +@PACKAGE_INIT@ |
| 54 | + |
| 55 | +set(PN pybind11) |
| 56 | + |
| 57 | +# find includes |
| 58 | +unset(_temp_h CACHE) |
| 59 | +find_path(_temp_h |
| 60 | + NAMES pybind11/pybind11.h |
| 61 | + PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@ |
| 62 | + NO_DEFAULT_PATH) |
| 63 | +if(_temp_h) |
| 64 | + set(${PN}_INCLUDE_DIR "${_temp_h}") |
| 65 | + set(${PN}_INCLUDE_DIRS ${${PN}_INCLUDE_DIR}) |
| 66 | +else() |
| 67 | + set(${PN}_FOUND 0) |
| 68 | + if(NOT CMAKE_REQUIRED_QUIET) |
| 69 | + message(STATUS "${PN}Config missing component: header (${PN}: ${_temp_h})") |
| 70 | + endif() |
| 71 | +endif() |
| 72 | + |
| 73 | +check_required_components(${PN}) |
| 74 | + |
| 75 | +#----------------------------------------------------------------------------- |
| 76 | +# Don't include targets if this file is being picked up by another |
| 77 | +# project which has already built this as a subproject |
| 78 | +#----------------------------------------------------------------------------- |
| 79 | +if(NOT TARGET ${PN}::pybind11) |
| 80 | + include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake") |
| 81 | +endif() |
| 82 | + |
0 commit comments