pybind11Config.cmake.in (11986:c12e4625ab56) pybind11Config.cmake.in (12037:d28054ac6ec9)
1# pybind11Config.cmake
2# --------------------
3#
4# PYBIND11 cmake module.
5# This module sets the following variables in your project::
6#
7# pybind11_FOUND - true if pybind11 and all required components found on the system
8# pybind11_VERSION - pybind11 version in format Major.Minor.Release

--- 12 unchanged lines hidden (view full) ---

21# Exported targets::
22#
23# If pybind11 is found, this module defines the following :prop_tgt:`IMPORTED`
24# target. Python headers, libraries (as needed by platform), and C++ standard
25# are attached to the target. Set PythonLibsNew variables to influence
26# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
27# influence standard setting. ::
28#
1# pybind11Config.cmake
2# --------------------
3#
4# PYBIND11 cmake module.
5# This module sets the following variables in your project::
6#
7# pybind11_FOUND - true if pybind11 and all required components found on the system
8# pybind11_VERSION - pybind11 version in format Major.Minor.Release

--- 12 unchanged lines hidden (view full) ---

21# Exported targets::
22#
23# If pybind11 is found, this module defines the following :prop_tgt:`IMPORTED`
24# target. Python headers, libraries (as needed by platform), and C++ standard
25# are attached to the target. Set PythonLibsNew variables to influence
26# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
27# influence standard setting. ::
28#
29# pybind11::pybind11 - the main pybind11 interface library (i.e., headers)
29# pybind11::module - the main pybind11 interface library for extension modules (i.e., headers)
30#
31# find_package(pybind11 CONFIG REQUIRED)
32# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
33# add_library(mylib MODULE main.cpp)
30#
31# find_package(pybind11 CONFIG REQUIRED)
32# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
33# add_library(mylib MODULE main.cpp)
34# target_link_libraries(mylib pybind11::pybind11)
34# target_link_libraries(mylib pybind11::module)
35#
36# Suggested usage::
37#
38# find_package with version info is not recommended except for release versions. ::
39#
40# find_package(pybind11 CONFIG)
41# find_package(pybind11 2.0 EXACT CONFIG REQUIRED)
42#

--- 23 unchanged lines hidden (view full) ---

66
67include(pybind11Tools)
68
69if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
70#-----------------------------------------------------------------------------
71# Don't include targets if this file is being picked up by another
72# project which has already built this as a subproject
73#-----------------------------------------------------------------------------
35#
36# Suggested usage::
37#
38# find_package with version info is not recommended except for release versions. ::
39#
40# find_package(pybind11 CONFIG)
41# find_package(pybind11 2.0 EXACT CONFIG REQUIRED)
42#

--- 23 unchanged lines hidden (view full) ---

66
67include(pybind11Tools)
68
69if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
70#-----------------------------------------------------------------------------
71# Don't include targets if this file is being picked up by another
72# project which has already built this as a subproject
73#-----------------------------------------------------------------------------
74if(NOT TARGET ${PN}::pybind11)
74if(NOT TARGET ${PN}::module)
75 include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
76
77 find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
75 include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
76
77 find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
78 set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
78 set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
79 if(WIN32 OR CYGWIN)
79 if(WIN32 OR CYGWIN)
80 set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
80 set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
81 endif()
82
83 select_cxx_standard()
81 endif()
82
83 select_cxx_standard()
84 set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
84 set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
85
85
86 get_property(_iid TARGET ${PN}::pybind11 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
87 get_property(_ill TARGET ${PN}::pybind11 PROPERTY INTERFACE_LINK_LIBRARIES)
88 get_property(_ico TARGET ${PN}::pybind11 PROPERTY INTERFACE_COMPILE_OPTIONS)
86 get_property(_iid TARGET ${PN}::module PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
87 get_property(_ill TARGET ${PN}::module PROPERTY INTERFACE_LINK_LIBRARIES)
88 get_property(_ico TARGET ${PN}::module PROPERTY INTERFACE_COMPILE_OPTIONS)
89 set(${PN}_INCLUDE_DIRS ${_iid})
90 set(${PN}_LIBRARIES ${_ico} ${_ill})
91endif()
92endif()
89 set(${PN}_INCLUDE_DIRS ${_iid})
90 set(${PN}_LIBRARIES ${_ico} ${_ill})
91endif()
92endif()