Blame external/pybind11/tools/pybind11Config.cmake.in

Packit 534379
# pybind11Config.cmake
Packit 534379
# --------------------
Packit 534379
#
Packit 534379
# PYBIND11 cmake module.
Packit 534379
# This module sets the following variables in your project::
Packit 534379
#
Packit 534379
#   pybind11_FOUND - true if pybind11 and all required components found on the system
Packit 534379
#   pybind11_VERSION - pybind11 version in format Major.Minor.Release
Packit 534379
#   pybind11_INCLUDE_DIRS - Directories where pybind11 and python headers are located.
Packit 534379
#   pybind11_INCLUDE_DIR - Directory where pybind11 headers are located.
Packit 534379
#   pybind11_DEFINITIONS - Definitions necessary to use pybind11, namely USING_pybind11.
Packit 534379
#   pybind11_LIBRARIES - compile flags and python libraries (as needed) to link against.
Packit 534379
#   pybind11_LIBRARY - empty.
Packit 534379
#   CMAKE_MODULE_PATH - appends location of accompanying FindPythonLibsNew.cmake and
Packit 534379
#                       pybind11Tools.cmake modules.
Packit 534379
#
Packit 534379
#
Packit 534379
# Available components: None
Packit 534379
#
Packit 534379
#
Packit 534379
# Exported targets::
Packit 534379
#
Packit 534379
# If pybind11 is found, this module defines the following :prop_tgt:`IMPORTED`
Packit 534379
# interface library targets::
Packit 534379
#
Packit 534379
#   pybind11::module - for extension modules
Packit 534379
#   pybind11::embed - for embedding the Python interpreter
Packit 534379
#
Packit 534379
# Python headers, libraries (as needed by platform), and the C++ standard
Packit 534379
# are attached to the target. Set PythonLibsNew variables to influence
Packit 534379
# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
Packit 534379
# influence standard setting. ::
Packit 534379
#
Packit 534379
#   find_package(pybind11 CONFIG REQUIRED)
Packit 534379
#   message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
Packit 534379
#
Packit 534379
#   # Create an extension module
Packit 534379
#   add_library(mylib MODULE main.cpp)
Packit 534379
#   target_link_libraries(mylib pybind11::module)
Packit 534379
#
Packit 534379
#   # Or embed the Python interpreter into an executable
Packit 534379
#   add_executable(myexe main.cpp)
Packit 534379
#   target_link_libraries(myexe pybind11::embed)
Packit 534379
#
Packit 534379
# Suggested usage::
Packit 534379
#
Packit 534379
# find_package with version info is not recommended except for release versions. ::
Packit 534379
#
Packit 534379
#   find_package(pybind11 CONFIG)
Packit 534379
#   find_package(pybind11 2.0 EXACT CONFIG REQUIRED)
Packit 534379
#
Packit 534379
#
Packit 534379
# The following variables can be set to guide the search for this package::
Packit 534379
#
Packit 534379
#   pybind11_DIR - CMake variable, set to directory containing this Config file
Packit 534379
#   CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
Packit 534379
#   PATH - environment variable, set to bin directory of this package
Packit 534379
#   CMAKE_DISABLE_FIND_PACKAGE_pybind11 - CMake variable, disables
Packit 534379
#     find_package(pybind11) when not REQUIRED, perhaps to force internal build
Packit 534379
Packit 534379
@PACKAGE_INIT@
Packit 534379
Packit 534379
set(PN pybind11)
Packit 534379
Packit 534379
# location of pybind11/pybind11.h
Packit 534379
set(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
Packit 534379
Packit 534379
set(${PN}_LIBRARY "")
Packit 534379
set(${PN}_DEFINITIONS USING_${PN})
Packit 534379
Packit 534379
check_required_components(${PN})
Packit 534379
Packit 534379
# make detectable the FindPythonLibsNew.cmake module
Packit 534379
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
Packit 534379
Packit 534379
include(pybind11Tools)
Packit 534379
Packit 534379
if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
Packit 534379
#-----------------------------------------------------------------------------
Packit 534379
# Don't include targets if this file is being picked up by another
Packit 534379
# project which has already built this as a subproject
Packit 534379
#-----------------------------------------------------------------------------
Packit 534379
if(NOT TARGET ${PN}::pybind11)
Packit 534379
    include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
Packit 534379
Packit 534379
    find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
Packit 534379
    set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
Packit 534379
    set_property(TARGET ${PN}::embed APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
Packit 534379
    if(WIN32 OR CYGWIN)
Packit 534379
      set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
Packit 534379
    endif()
Packit 534379
Packit 534379
    if(CMAKE_VERSION VERSION_LESS 3.3)
Packit 534379
      set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
Packit 534379
    else()
Packit 534379
      set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CXX>:${PYBIND11_CPP_STANDARD}>)
Packit 534379
    endif()
Packit 534379
Packit 534379
    get_property(_iid TARGET ${PN}::pybind11 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
Packit 534379
    get_property(_ill TARGET ${PN}::module PROPERTY INTERFACE_LINK_LIBRARIES)
Packit 534379
    set(${PN}_INCLUDE_DIRS ${_iid})
Packit 534379
    set(${PN}_LIBRARIES ${_ico} ${_ill})
Packit 534379
endif()
Packit 534379
endif()