Back to home page

EIC code displayed by LXR

 
 

    


Warning, /jana2/src/python/externals/pybind11-2.10.3/tools/pybind11Config.cmake.in is written in an unsupported language. File is not indexed.

0001 #[=============================================================================[.rst:
0002 
0003 pybind11Config.cmake
0004 ####################
0005 
0006 Exported variables
0007 ==================
0008 
0009 This module sets the following variables in your project:
0010 
0011 ``pybind11_FOUND``
0012   true if pybind11 and all required components found on the system
0013 ``pybind11_VERSION``
0014   pybind11 version in format Major.Minor.Release
0015 ``pybind11_VERSION_TYPE``
0016   pybind11 version type (``dev*`` or empty for a release)
0017 ``pybind11_INCLUDE_DIRS``
0018   Directories where pybind11 and python headers are located.
0019 ``pybind11_INCLUDE_DIR``
0020   Directory where pybind11 headers are located.
0021 ``pybind11_DEFINITIONS``
0022   Definitions necessary to use pybind11, namely USING_pybind11.
0023 ``pybind11_LIBRARIES``
0024   Compile flags and python libraries (as needed) to link against.
0025 ``pybind11_LIBRARY``
0026   Empty.
0027 
0028 Available components: None
0029 
0030 
0031 Exported targets
0032 ================
0033 
0034 If pybind11 is found, this module defines the following ``IMPORTED``
0035 interface library targets:
0036 
0037 ``pybind11::module``
0038   for extension modules.
0039 ``pybind11::embed``
0040   for embedding the Python interpreter.
0041 
0042 Python headers, libraries (as needed by platform), and the C++ standard
0043 are attached to the target.
0044 
0045 Advanced targets are also supplied - these are primary for users building
0046 complex applications, and they are available in all modes:
0047 
0048 ``pybind11::headers``
0049   Just the pybind11 headers and minimum compile requirements.
0050 ``pybind11::pybind11``
0051   Python headers too.
0052 ``pybind11::python_link_helper``
0053   Just the "linking" part of ``pybind11:module``, for CMake < 3.15.
0054 ``pybind11::thin_lto``
0055   An alternative to ``INTERPROCEDURAL_OPTIMIZATION``.
0056 ``pybind11::lto``
0057   An alternative to ``INTERPROCEDURAL_OPTIMIZATION`` (also avoids thin LTO on clang).
0058 ``pybind11::windows_extras``
0059   Adds bigobj and mp for MSVC.
0060 
0061 Modes
0062 =====
0063 
0064 There are two modes provided; classic, which is built on the old Python
0065 discovery packages in CMake, or the new FindPython mode, which uses FindPython
0066 from 3.12+ forward (3.15+ _highly_ recommended).
0067 
0068 New FindPython mode
0069 ^^^^^^^^^^^^^^^^^^^
0070 
0071 To activate this mode, either call ``find_package(Python COMPONENTS Interpreter Development)``
0072 before finding this package, or set the ``PYBIND11_FINDPYTHON`` variable to ON. In this mode,
0073 you can either use the basic targets, or use the FindPython tools:
0074 
0075 .. code-block:: cmake
0076 
0077   find_package(Python COMPONENTS Interpreter Development)
0078   find_package(pybind11 CONFIG)
0079 
0080   # pybind11 method:
0081   pybind11_add_module(MyModule1 src1.cpp)
0082 
0083   # Python method:
0084   Python_add_library(MyModule2 src2.cpp)
0085   target_link_libraries(MyModule2 pybind11::headers)
0086   set_target_properties(MyModule2 PROPERTIES
0087                                   INTERPROCEDURAL_OPTIMIZATION ON
0088                                   CXX_VISIBILITY_PRESET ON
0089                                   VISIBILITY_INLINES_HIDDEN ON)
0090 
0091 If you build targets yourself, you may be interested in stripping the output
0092 for reduced size; this is the one other feature that the helper function gives you.
0093 
0094 Classic mode
0095 ^^^^^^^^^^^^
0096 
0097 Set PythonLibsNew variables to influence python detection and
0098 CMAKE_CXX_STANDARD to influence standard setting.
0099 
0100 .. code-block:: cmake
0101 
0102   find_package(pybind11 CONFIG REQUIRED)
0103 
0104   # Create an extension module
0105   add_library(mylib MODULE main.cpp)
0106   target_link_libraries(mylib PUBLIC pybind11::module)
0107 
0108   # Or embed the Python interpreter into an executable
0109   add_executable(myexe main.cpp)
0110   target_link_libraries(myexe PUBLIC pybind11::embed)
0111 
0112 
0113 Hints
0114 =====
0115 
0116 The following variables can be set to guide the search for this package:
0117 
0118 ``pybind11_DIR``
0119   CMake variable, set to directory containing this Config file.
0120 ``CMAKE_PREFIX_PATH``
0121   CMake variable, set to root directory of this package.
0122 ``PATH``
0123   Environment variable, set to bin directory of this package.
0124 ``CMAKE_DISABLE_FIND_PACKAGE_pybind11``
0125   CMake variable, disables ``find_package(pybind11)`` when not ``REQUIRED``,
0126   perhaps to force internal build.
0127 
0128 Commands
0129 ========
0130 
0131 pybind11_add_module
0132 ^^^^^^^^^^^^^^^^^^^
0133 
0134 This module defines the following commands to assist with creating Python modules:
0135 
0136 .. code-block:: cmake
0137 
0138   pybind11_add_module(<target>
0139     [STATIC|SHARED|MODULE]
0140     [THIN_LTO] [OPT_SIZE] [NO_EXTRAS] [WITHOUT_SOABI]
0141     <files>...
0142     )
0143 
0144 Add a module and setup all helpers. You can select the type of the library; the
0145 default is ``MODULE``. There are several options:
0146 
0147 ``OPT_SIZE``
0148   Optimize for size, even if the ``CMAKE_BUILD_TYPE`` is not ``MinSizeRel``.
0149 ``THIN_LTO``
0150   Use thin TLO instead of regular if there's a choice (pybind11's selection
0151   is disabled if ``CMAKE_INTERPROCEDURAL_OPTIMIZATIONS`` is set).
0152 ``WITHOUT_SOABI``
0153   Disable the SOABI component (``PYBIND11_NEWPYTHON`` mode only).
0154 ``NO_EXTRAS``
0155   Disable all extras, exit immediately after making the module.
0156 
0157 pybind11_strip
0158 ^^^^^^^^^^^^^^
0159 
0160 .. code-block:: cmake
0161 
0162   pybind11_strip(<target>)
0163 
0164 Strip a target after building it (linux/macOS), called by ``pybind11_add_module``.
0165 
0166 pybind11_extension
0167 ^^^^^^^^^^^^^^^^^^
0168 
0169 .. code-block:: cmake
0170 
0171     pybind11_extension(<target>)
0172 
0173 Sets the Python extension name correctly for Python on your platform, called by
0174 ``pybind11_add_module``.
0175 
0176 pybind11_find_import(module)
0177 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0178 
0179 .. code-block:: cmake
0180 
0181     pybind11_find_import(<module> [VERSION <number>] [REQUIRED] [QUIET])
0182 
0183 See if a module is installed. Use the registered name (the one on PyPI). You
0184 can specify a ``VERSION``, and you can specify ``REQUIRED`` or ``QUIET``. Only available if
0185 ``NOPYTHON`` mode is not active.  Sets ``module_VERSION`` and ``module_FOUND``. Caches the
0186 result once a valid install is found.
0187 
0188 Suggested usage
0189 ===============
0190 
0191 Using ``find_package`` with version info is not recommended except for release versions.
0192 
0193 .. code-block:: cmake
0194 
0195   find_package(pybind11 CONFIG)
0196   find_package(pybind11 2.9 EXACT CONFIG REQUIRED)
0197 
0198 #]=============================================================================]
0199 @PACKAGE_INIT@
0200 
0201 # Location of pybind11/pybind11.h
0202 # This will be relative unless explicitly set as absolute
0203 set(pybind11_INCLUDE_DIR "@pybind11_INCLUDEDIR@")
0204 
0205 set(pybind11_LIBRARY "")
0206 set(pybind11_DEFINITIONS USING_pybind11)
0207 set(pybind11_VERSION_TYPE "@pybind11_VERSION_TYPE@")
0208 
0209 check_required_components(pybind11)
0210 
0211 if(TARGET pybind11::python_link_helper)
0212   # This has already been setup elsewhere, such as with a previous call or
0213   # add_subdirectory
0214   return()
0215 endif()
0216 
0217 include("${CMAKE_CURRENT_LIST_DIR}/pybind11Targets.cmake")
0218 
0219 # Easier to use / remember
0220 add_library(pybind11::headers IMPORTED INTERFACE)
0221 set_target_properties(pybind11::headers PROPERTIES INTERFACE_LINK_LIBRARIES
0222                                                    pybind11::pybind11_headers)
0223 
0224 include("${CMAKE_CURRENT_LIST_DIR}/pybind11Common.cmake")
0225 
0226 if(NOT pybind11_FIND_QUIETLY)
0227   message(
0228     STATUS
0229       "Found pybind11: ${pybind11_INCLUDE_DIR} (found version \"${pybind11_VERSION}${pybind11_VERSION_TYPE}\")"
0230   )
0231 endif()