code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPackageHandleStandardArgs — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPackageMessage" href="FindPackageMessage.html" />
    <link rel="prev" title="FetchContent" href="FetchContent.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPackageHandleStandardArgs

FindPackageHandleStandardArgs¶

This module provides functions intended to be used in Find Modules
implementing find_package(<PackageName>) calls.

find_package_handle_standard_args¶

This command handles the REQUIRED, QUIET and version-related
arguments of find_package().  It also sets the
<PackageName>_FOUND variable.  The package is considered found if all
variables listed contain valid results, e.g. valid filepaths.

There are two signatures:

find_package_handle_standard_args(<PackageName>
  (DEFAULT_MSG|<custom-failure-message>)
  <required-var>...
  )

find_package_handle_standard_args(<PackageName>
  [FOUND_VAR <result-var>]
  [REQUIRED_VARS <required-var>...]
  [VERSION_VAR <version-var>]
  [HANDLE_VERSION_RANGE]
  [HANDLE_COMPONENTS]
  [CONFIG_MODE]
  [NAME_MISMATCHED]
  [REASON_FAILURE_MESSAGE <reason-failure-message>]
  [FAIL_MESSAGE <custom-failure-message>]
  )

The <PackageName>_FOUND variable will be set to TRUE if all
the variables <required-var>... are valid and any optional
constraints are satisfied, and FALSE otherwise.  A success or
failure message may be displayed based on the results and on
whether the REQUIRED and/or QUIET option was given to
the find_package() call.

The options are:

(DEFAULT_MSG|<custom-failure-message>)

In the simple signature this specifies the failure message.
Use DEFAULT_MSG to ask for a default message to be computed
(recommended).  Not valid in the full signature.

FOUND_VAR <result-var>

Deprecated since version 3.3.

Specifies either <PackageName>_FOUND or
<PACKAGENAME>_FOUND as the result variable.  This exists only
for compatibility with older versions of CMake and is now ignored.
Result variables of both names are always set for compatibility.

REQUIRED_VARS <required-var>...

Specify the variables which are required for this package.
These may be named in the generated failure message asking the
user to set the missing variable values.  Therefore these should
typically be cache entries such as FOO_LIBRARY and not output
variables like FOO_LIBRARIES.

Changed in version 3.18: If HANDLE_COMPONENTS is specified, this option can be omitted.

VERSION_VAR <version-var>

Specify the name of a variable that holds the version of the package
that has been found.  This version will be checked against the
(potentially) specified required version given to the
find_package() call, including its EXACT option.
The default messages include information about the required
version and the version which has been actually found, both
if the version is ok or not.

HANDLE_VERSION_RANGE

New in version 3.19.

Enable handling of a version range, if one is specified. Without this
option, a developer warning will be displayed if a version range is
specified.

HANDLE_COMPONENTS

Enable handling of package components.  In this case, the command
will report which components have been found and which are missing,
and the <PackageName>_FOUND variable will be set to FALSE
if any of the required components (i.e. not the ones listed after
the OPTIONAL_COMPONENTS option of find_package()) are
missing.

CONFIG_MODE

Specify that the calling find module is a wrapper around a
call to find_package(<PackageName> NO_MODULE).  This implies
a VERSION_VAR value of <PackageName>_VERSION.  The command
will automatically check whether the package configuration file
was found.

REASON_FAILURE_MESSAGE <reason-failure-message>

New in version 3.16.

Specify a custom message of the reason for the failure which will be
appended to the default generated message.

FAIL_MESSAGE <custom-failure-message>

Specify a custom failure message instead of using the default
generated message.  Not recommended.

NAME_MISMATCHED

New in version 3.17.

Indicate that the <PackageName> does not match
${CMAKE_FIND_PACKAGE_NAME}. This is usually a mistake and raises a
warning, but it may be intentional for usage of the command for components
of a larger package.

Example for the simple signature:

find_package_handle_standard_args(LibXml2 DEFAULT_MSG
  LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)

The LibXml2 package is considered to be found if both
LIBXML2_LIBRARY and LIBXML2_INCLUDE_DIR are valid.
Then also LibXml2_FOUND is set to TRUE.  If it is not found
and REQUIRED was used, it fails with a
message(FATAL_ERROR), independent whether QUIET was
used or not.  If it is found, success will be reported, including
the content of the first <required-var>.  On repeated CMake runs,
the same message will not be printed again.

Note

If <PackageName> does not match CMAKE_FIND_PACKAGE_NAME for the
calling module, a warning that there is a mismatch is given. The
FPHSA_NAME_MISMATCHED variable may be set to bypass the warning if using
the old signature and the NAME_MISMATCHED argument using the new
signature. To avoid forcing the caller to require newer versions of CMake for
usage, the variable's value will be used if defined when the
NAME_MISMATCHED argument is not passed for the new signature (but using
both is an error)..

Example for the full signature:

find_package_handle_standard_args(LibArchive
  REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
  VERSION_VAR LibArchive_VERSION)

In this case, the LibArchive package is considered to be found if
both LibArchive_LIBRARY and LibArchive_INCLUDE_DIR are valid.
Also the version of LibArchive will be checked by using the version
contained in LibArchive_VERSION.  Since no FAIL_MESSAGE is given,
the default messages will be printed.

Another example for the full signature:

find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
find_package_handle_standard_args(Automoc4  CONFIG_MODE)

In this case, a FindAutmoc4.cmake module wraps a call to
find_package(Automoc4 NO_MODULE) and adds an additional search
directory for automoc4.  Then the call to
find_package_handle_standard_args produces a proper success/failure
message.

find_package_check_version¶

New in version 3.19.

Helper function which can be used to check if a <version> is valid
against version-related arguments of find_package().

find_package_check_version(<version> <result-var>
  [HANDLE_VERSION_RANGE]
  [RESULT_MESSAGE_VARIABLE <message-var>]
  )

The <result-var> will hold a boolean value giving the result of the check.

The options are:

HANDLE_VERSION_RANGE

Enable handling of a version range, if one is specified. Without this
option, a developer warning will be displayed if a version range is
specified.

RESULT_MESSAGE_VARIABLE <message-var>

Specify a variable to get back a message describing the result of the check.

Example for the usage:

find_package_check_version(1.2.3 result HANDLE_VERSION_RANGE
  RESULT_MESSAGE_VARIABLE reason)
if (result)
  message (STATUS "${reason}")
else()
  message (FATAL_ERROR "${reason}")
endif()

Previous topic

FetchContent

Next topic

FindPackageMessage

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPackageHandleStandardArgs

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPackageMessage — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FortranCInterface" href="FortranCInterface.html" />
    <link rel="prev" title="FindPackageHandleStandardArgs" href="FindPackageHandleStandardArgs.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPackageMessage

FindPackageMessage¶

find_package_message(<name> "message for user" "find result details")

This function is intended to be used in FindXXX.cmake modules files.
It will print a message once for each unique find result.  This is
useful for telling the user where a package was found.  The first
argument specifies the name (XXX) of the package.  The second argument
specifies the message to display.  The third argument lists details
about the find result so that if they change the message will be
displayed again.  The macro also obeys the QUIET argument to the
find_package command.

Example:

if(X11_FOUND)
  find_package_message(X11 "Found X11: ${X11_X11_LIB}"
    "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
else()
 ...
endif()

Previous topic

FindPackageHandleStandardArgs

Next topic

FortranCInterface

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPackageMessage

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.

repo_name: lazytadpole/codenamesilverfish

license: mit


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPatch — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPerl" href="FindPerl.html" />
    <link rel="prev" title="FindosgWidget" href="FindosgWidget.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPatch

FindPatch¶

New in version 3.10.

The module defines the following variables:

Patch_EXECUTABLE

Path to patch command-line executable.

Patch_FOUND

True if the patch command-line executable was found.

The following IMPORTED targets are also defined:

Patch::patch

The command-line executable.

Example usage:

find_package(Patch)
if(Patch_FOUND)
  message("Patch found: ${Patch_EXECUTABLE}")
endif()

Previous topic

FindosgWidget

Next topic

FindPerl

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPatch

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPerl — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPerlLibs" href="FindPerlLibs.html" />
    <link rel="prev" title="FindPatch" href="FindPatch.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPerl

FindPerl¶

Find a Perl interpreter.

This module defines the following variables:

PERL_EXECUTABLE

The full path to Perl.

PERL_FOUND

True if the Perl executable was found.

PERL_VERSION_STRING

New in version 2.8.8.

The version of Perl found.

Previous topic

FindPatch

Next topic

FindPerlLibs

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPerl

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPerlLibs — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPHP4" href="FindPHP4.html" />
    <link rel="prev" title="FindPerl" href="FindPerl.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPerlLibs

FindPerlLibs¶

Find Perl libraries

This module finds if PERL is installed and determines where the
include files and libraries are.  It also determines what the name of
the library is.  This code sets the following variables:

PERLLIBS_FOUND    = True if perl.h & libperl were found
PERL_INCLUDE_PATH = path to where perl.h is found
PERL_LIBRARY      = path to libperl
PERL_EXECUTABLE   = full path to the perl binary

The minimum required version of Perl can be specified using the
standard syntax, e.g.  find_package(PerlLibs 6.0)

The following variables are also available if needed
(introduced after CMake 2.6.4)

PERL_SITESEARCH     = path to the sitesearch install dir (-V:installsitesearch)
PERL_SITEARCH       = path to the sitelib install directory (-V:installsitearch)
PERL_SITELIB        = path to the sitelib install directory (-V:installsitelib)
PERL_VENDORARCH     = path to the vendor arch install directory (-V:installvendorarch)
PERL_VENDORLIB      = path to the vendor lib install directory (-V:installvendorlib)
PERL_ARCHLIB        = path to the core arch lib install directory (-V:archlib)
PERL_PRIVLIB        = path to the core priv lib install directory (-V:privlib)
PERL_UPDATE_ARCHLIB = path to the update arch lib install directory (-V:installarchlib)
PERL_UPDATE_PRIVLIB = path to the update priv lib install directory (-V:installprivlib)
PERL_EXTRA_C_FLAGS = Compilation flags used to build perl

Previous topic

FindPerl

Next topic

FindPHP4

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPerlLibs

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPhysFS — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPike" href="FindPike.html" />
    <link rel="prev" title="FindPHP4" href="FindPHP4.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPhysFS

FindPhysFS¶

Locate PhysFS library This module defines:

PHYSFS_LIBRARY

the name of the library to link against

PHYSFS_FOUND

if false, do not try to link to PHYSFS

PHYSFS_INCLUDE_DIR

where to find physfs.h

$PHYSFSDIR is an environment variable that would correspond to:

./configure --prefix=$PHYSFSDIR

used in building PHYSFS.

Previous topic

FindPHP4

Next topic

FindPike

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPhysFS

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPike — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPkgConfig" href="FindPkgConfig.html" />
    <link rel="prev" title="FindPhysFS" href="FindPhysFS.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPike

FindPike¶

Find Pike

This module finds if PIKE is installed and determines where the
include files and libraries are.  It also determines what the name of
the library is.  This code sets the following variables:

PIKE_INCLUDE_PATH       = path to where program.h is found
PIKE_EXECUTABLE         = full path to the pike binary

Previous topic

FindPhysFS

Next topic

FindPkgConfig

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPike

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPkgConfig — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPNG" href="FindPNG.html" />
    <link rel="prev" title="FindPike" href="FindPike.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPkgConfig

FindPkgConfig¶

A pkg-config module for CMake.

Finds the pkg-config executable and adds the pkg_get_variable(),
pkg_check_modules() and pkg_search_module() commands. The
following variables will also be set:

PKG_CONFIG_FOUND

True if a pkg-config executable was found.

PKG_CONFIG_VERSION_STRING

New in version 2.8.8.

The version of pkg-config that was found.

PKG_CONFIG_EXECUTABLE

The pathname of the pkg-config program.

PKG_CONFIG_ARGN

New in version 3.22.

A list of arguments to pass to pkg-config.

Both PKG_CONFIG_EXECUTABLE and PKG_CONFIG_ARGN are initialized by the
module, but may be overridden by the user.  See Variables Affecting Behavior
for how these variables are initialized.

pkg_check_modules¶

Checks for all the given modules, setting a variety of result variables in
the calling scope.

pkg_check_modules(<prefix>
                  [REQUIRED] [QUIET]
                  [NO_CMAKE_PATH]
                  [NO_CMAKE_ENVIRONMENT_PATH]
                  [IMPORTED_TARGET [GLOBAL]]
                  <moduleSpec> [<moduleSpec>...])

When the REQUIRED argument is given, the command will fail with an error
if module(s) could not be found.

When the QUIET argument is given, no status messages will be printed.

New in version 3.1: The CMAKE_PREFIX_PATH,
CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache
and environment variables will be added to the pkg-config search path.
The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments
disable this behavior for the cache variables and environment variables
respectively.
The PKG_CONFIG_USE_CMAKE_PREFIX_PATH variable set to FALSE
disables this behavior globally.

New in version 3.6: The IMPORTED_TARGET argument will create an imported target named
PkgConfig::<prefix> that can be passed directly as an argument to
target_link_libraries().

New in version 3.13: The GLOBAL argument will make the
imported target available in global scope.

New in version 3.15: Non-library linker options reported by pkg-config are stored in the
INTERFACE_LINK_OPTIONS target property.

Changed in version 3.18: Include directories specified with -isystem are stored in the
INTERFACE_INCLUDE_DIRECTORIES target property.  Previous
versions of CMake left them in the INTERFACE_COMPILE_OPTIONS
property.

Each <moduleSpec> can be either a bare module name or it can be a
module name with a version constraint (operators =, <, >,
<= and >= are supported).  The following are examples for a module
named foo with various constraints:

foo matches any version.

foo<2 only matches versions before 2.

foo>=3.1 matches any version from 3.1 or later.

foo=1.2.3 requires that foo must be exactly version 1.2.3.

The following variables may be set upon return.  Two sets of values exist:
One for the common case (<XXX> = <prefix>) and another for the
information pkg-config provides when called with the --static
option (<XXX> = <prefix>_STATIC).

<XXX>_FOUND

set to 1 if module(s) exist

<XXX>_LIBRARIES

only the libraries (without the '-l')

<XXX>_LINK_LIBRARIES

the libraries and their absolute paths

<XXX>_LIBRARY_DIRS

the paths of the libraries (without the '-L')

<XXX>_LDFLAGS

all required linker flags

<XXX>_LDFLAGS_OTHER

all other linker flags

<XXX>_INCLUDE_DIRS

the '-I' preprocessor flags (without the '-I')

<XXX>_CFLAGS

all required cflags

<XXX>_CFLAGS_OTHER

the other compiler flags

All but <XXX>_FOUND may be a ;-list if the
associated variable returned from pkg-config has multiple values.

Changed in version 3.18: Include directories specified with -isystem are stored in the
<XXX>_INCLUDE_DIRS variable.  Previous versions of CMake left them
in <XXX>_CFLAGS_OTHER.

There are some special variables whose prefix depends on the number of
<moduleSpec> given.  When there is only one <moduleSpec>,
<YYY> will simply be <prefix>, but if two or more <moduleSpec>
items are given, <YYY> will be <prefix>_<moduleName>.

<YYY>_VERSION

version of the module

<YYY>_PREFIX

prefix directory of the module

<YYY>_INCLUDEDIR

include directory of the module

<YYY>_LIBDIR

lib directory of the module

Changed in version 3.8: For any given <prefix>, pkg_check_modules() can be called multiple
times with different parameters.  Previous versions of CMake cached and
returned the first successful result.

Changed in version 3.16: If a full path to the found library can't be determined, but it's still
visible to the linker, pass it through as -l<name>.  Previous versions
of CMake failed in this case.

Examples:

pkg_check_modules (GLIB2 glib-2.0)

Looks for any version of glib2.  If found, the output variable
GLIB2_VERSION will hold the actual version found.

pkg_check_modules (GLIB2 glib-2.0>=2.10)

Looks for at least version 2.10 of glib2.  If found, the output variable
GLIB2_VERSION will hold the actual version found.

pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)

Looks for both glib2-2.0 (at least version 2.10) and any version of
gtk2+-2.0.  Only if both are found will FOO be considered found.
The FOO_glib-2.0_VERSION and FOO_gtk+-2.0_VERSION variables will be
set to their respective found module versions.

pkg_check_modules (XRENDER REQUIRED xrender)

Requires any version of xrender.  Example output variables set by a
successful call:

XRENDER_LIBRARIES=Xrender;X11
XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp

pkg_search_module¶

The behavior of this command is the same as pkg_check_modules(),
except that rather than checking for all the specified modules, it searches
for just the first successful match.

pkg_search_module(<prefix>
                  [REQUIRED] [QUIET]
                  [NO_CMAKE_PATH]
                  [NO_CMAKE_ENVIRONMENT_PATH]
                  [IMPORTED_TARGET [GLOBAL]]
                  <moduleSpec> [<moduleSpec>...])

New in version 3.16: If a module is found, the <prefix>_MODULE_NAME variable will contain the
name of the matching module. This variable can be used if you need to run
pkg_get_variable().

Example:

pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)

pkg_get_variable¶

New in version 3.4.

Retrieves the value of a pkg-config variable varName and stores it in the
result variable resultVar in the calling scope.

pkg_get_variable(<resultVar> <moduleName> <varName>
                 [DEFINE_VARIABLES <key>=<value>...])

If pkg-config returns multiple values for the specified variable,
resultVar will contain a ;-list.

Options:

DEFINE_VARIABLES <key>=<value>...

New in version 3.28.

Specify key-value pairs to redefine variables affecting the variable
retrieved with pkg-config.

For example:

pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)

Variables Affecting Behavior¶

PKG_CONFIG_EXECUTABLE¶

This cache variable can be set to the path of the pkg-config executable.
find_program() is called internally by the module with this
variable.

New in version 3.1: The PKG_CONFIG environment variable can be used as a hint if
PKG_CONFIG_EXECUTABLE has not yet been set.

Changed in version 3.22: If the PKG_CONFIG environment variable is set, only the first
argument is taken from it when using it as a hint.

PKG_CONFIG_ARGN¶

New in version 3.22.

This cache variable can be set to a list of arguments to additionally pass
to pkg-config if needed. If not provided, it will be initialized from the
PKG_CONFIG environment variable, if set. The first argument in that
environment variable is assumed to be the pkg-config program, while all
remaining arguments after that are used to initialize PKG_CONFIG_ARGN.
If no such environment variable is defined, PKG_CONFIG_ARGN is
initialized to an empty string. The module does not update the variable once
it has been set in the cache.

PKG_CONFIG_USE_CMAKE_PREFIX_PATH¶

New in version 3.1.

Specifies whether pkg_check_modules() and
pkg_search_module() should add the paths in the
CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH and
CMAKE_APPBUNDLE_PATH cache and environment variables to the
pkg-config search path.

If this variable is not set, this behavior is enabled by default if
CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later, disabled
otherwise.

Table of Contents

FindPkgConfig

Variables Affecting Behavior

Previous topic

FindPike

Next topic

FindPNG

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPkgConfig

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPostgreSQL — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindProducer" href="FindProducer.html" />
    <link rel="prev" title="FindPNG" href="FindPNG.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPostgreSQL

FindPostgreSQL¶

Find the PostgreSQL installation.

IMPORTED Targets¶

New in version 3.14.

This module defines IMPORTED target PostgreSQL::PostgreSQL
if PostgreSQL has been found.

Result Variables¶

This module will set the following variables in your project:

PostgreSQL_FOUND

True if PostgreSQL is found.

PostgreSQL_LIBRARIES

the PostgreSQL libraries needed for linking

PostgreSQL_INCLUDE_DIRS

the directories of the PostgreSQL headers

PostgreSQL_LIBRARY_DIRS

the link directories for PostgreSQL libraries

PostgreSQL_VERSION_STRING

the version of PostgreSQL found

PostgreSQL_TYPE_INCLUDE_DIR

the directories of the PostgreSQL server headers

Components¶

This module contains additional Server component, that forcibly checks
for the presence of server headers. Note that PostgreSQL_TYPE_INCLUDE_DIR
is set regardless of the presence of the Server component in find_package call.

Table of Contents

FindPostgreSQL

IMPORTED Targets

Result Variables

Components

Previous topic

FindPNG

Next topic

FindProducer

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPostgreSQL

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindProducer — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindProtobuf" href="FindProtobuf.html" />
    <link rel="prev" title="FindPostgreSQL" href="FindPostgreSQL.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindProducer

FindProducer¶

Though Producer isn't directly part of OpenSceneGraph, its primary
user is OSG so I consider this part of the Findosg* suite used to find
OpenSceneGraph components.  You'll notice that I accept OSGDIR as an
environment path.

Each component is separate and you must opt in to each module.  You
must also opt into OpenGL (and OpenThreads?) as these modules won't do
it for you.  This is to allow you control over your own system piece
by piece in case you need to opt out of certain components or change
the Find behavior for a particular module (perhaps because the default
FindOpenGL module doesn't work with your system as an example).
If you want to use a more convenient module that includes everything,
use the FindOpenSceneGraph instead of the Findosg*.cmake
modules.

Locate Producer This module defines:

PRODUCER_LIBRARY

PRODUCER_FOUND

if false, do not try to link to Producer

PRODUCER_INCLUDE_DIR

where to find the headers

$PRODUCER_DIR is an environment variable that would correspond to:

./configure --prefix=$PRODUCER_DIR

used in building osg.

Previous topic

FindPostgreSQL

Next topic

FindProtobuf

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindProducer

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindProtobuf — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPython" href="FindPython.html" />
    <link rel="prev" title="FindProducer" href="FindProducer.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindProtobuf

FindProtobuf¶

Locate and configure the Google Protocol Buffers library.

New in version 3.6: Support for find_package() version checks.

Changed in version 3.6: All input and output variables use the Protobuf_ prefix.
Variables with PROTOBUF_ prefix are still supported for compatibility.

The following variables can be set and are optional:

Protobuf_SRC_ROOT_FOLDER

When compiling with MSVC, if this cache variable is set
the protobuf-default VS project build locations
(vsprojects/Debug and vsprojects/Release
or vsprojects/x64/Debug and vsprojects/x64/Release)
will be searched for libraries and binaries.

Protobuf_IMPORT_DIRS

List of additional directories to be searched for
imported .proto files.

Protobuf_DEBUG

New in version 3.6.

Show debug messages.

Protobuf_USE_STATIC_LIBS

New in version 3.9.

Set to ON to force the use of the static libraries.
Default is OFF.

Defines the following variables:

Protobuf_FOUND

Found the Google Protocol Buffers library
(libprotobuf & header files)

Protobuf_VERSION

New in version 3.6.

Version of package found.

Protobuf_INCLUDE_DIRS

Include directories for Google Protocol Buffers

Protobuf_LIBRARIES

The protobuf libraries

Protobuf_PROTOC_LIBRARIES

The protoc libraries

Protobuf_LITE_LIBRARIES

The protobuf-lite libraries

New in version 3.9: The following IMPORTED targets are also defined:

protobuf::libprotobuf

The protobuf library.

protobuf::libprotobuf-lite

The protobuf lite library.

protobuf::libprotoc

The protoc library.

protobuf::protoc

New in version 3.10: The protoc compiler.

The following cache variables are also available to set or use:

Protobuf_LIBRARY

The protobuf library

Protobuf_PROTOC_LIBRARY

The protoc library

Protobuf_INCLUDE_DIR

The include directory for protocol buffers

Protobuf_PROTOC_EXECUTABLE

The protoc compiler

Protobuf_LIBRARY_DEBUG

The protobuf library (debug)

Protobuf_PROTOC_LIBRARY_DEBUG

The protoc library (debug)

Protobuf_LITE_LIBRARY

The protobuf lite library

Protobuf_LITE_LIBRARY_DEBUG

The protobuf lite library (debug)

Example:

find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS DESCRIPTORS PROTO_DESCS foo.proto)
protobuf_generate_python(PROTO_PY foo.proto)
add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(bar ${Protobuf_LIBRARIES})

Note

The protobuf_generate_cpp and protobuf_generate_python
functions and add_executable() or add_library()
calls only work properly within the same directory.

protobuf_generate_cpp¶

Add custom commands to process .proto files to C++:

protobuf_generate_cpp (<SRCS> <HDRS>
    [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])

SRCS

Variable to define with autogenerated source files

HDRS

Variable to define with autogenerated header files

DESCRIPTORS

New in version 3.10: Variable to define with autogenerated descriptor files, if requested.

EXPORT_MACRO

is a macro which should expand to __declspec(dllexport) or
__declspec(dllimport) depending on what is being compiled.

ARGN

.proto files

protobuf_generate_python¶

New in version 3.4.

Add custom commands to process .proto files to Python:

protobuf_generate_python (<PY> [<ARGN>...])

PY

Variable to define with autogenerated Python files

ARGN

.proto files

protobuf_generate¶

New in version 3.13.

Automatically generate source files from .proto schema files at build time:

protobuf_generate (
    TARGET <target>
    [LANGUAGE <lang>]
    [OUT_VAR <out_var>]
    [EXPORT_MACRO <macro>]
    [PROTOC_OUT_DIR <dir>]
    [PLUGIN <plugin>]
    [PLUGIN_OPTIONS <plugin_options>]
    [DEPENDENCIES <depends]
    [PROTOS <protobuf_files>]
    [IMPORT_DIRS <dirs>]
    [GENERATE_EXTENSIONS <extensions>]
    [PROTOC_OPTIONS <protoc_options>]
    [APPEND_PATH])

APPEND_PATH

A flag that causes the base path of all proto schema files to be added to
IMPORT_DIRS.

LANGUAGE

A single value: cpp or python. Determines what kind of source files are
being generated. Defaults to cpp.

OUT_VAR

Name of a CMake variable that will be filled with the paths to the generated
source files.

EXPORT_MACRO

Name of a macro that is applied to all generated Protobuf message classes
and extern variables. It can, for example, be used to declare DLL exports.

PROTOC_OUT_DIR

Output directory of generated source files. Defaults to CMAKE_CURRENT_BINARY_DIR.

PLUGIN

New in version 3.21.

An optional plugin executable. This could, for example, be the path to
grpc_cpp_plugin.

PLUGIN_OPTIONS

New in version 3.28.

Additional options provided to the plugin, such as generate_mock_code=true
for the gRPC cpp plugin.

DEPENDENCIES

New in version 3.28.

Arguments forwarded to the DEPENDS of the underlying add_custom_command
invocation.

TARGET

CMake target that will have the generated files added as sources.

PROTOS

List of proto schema files. If omitted, then every source file ending in proto of TARGET will be used.

IMPORT_DIRS

A common parent directory for the schema files. For example, if the schema file is
proto/helloworld/helloworld.proto and the import directory proto/ then the
generated files are ${PROTOC_OUT_DIR}/helloworld/helloworld.pb.h and
${PROTOC_OUT_DIR}/helloworld/helloworld.pb.cc.

GENERATE_EXTENSIONS

If LANGUAGE is omitted then this must be set to the extensions that protoc generates.

PROTOC_OPTIONS

New in version 3.28.

Additional arguments that are forwarded to protoc.

Example:

find_package(gRPC CONFIG REQUIRED)
find_package(Protobuf REQUIRED)
add_library(ProtoTest Test.proto)
target_link_libraries(ProtoTest PUBLIC gRPC::grpc++)
protobuf_generate(TARGET ProtoTest)
protobuf_generate(
    TARGET ProtoTest
    LANGUAGE grpc
    PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
    PLUGIN_OPTIONS generate_mock_code=true
    GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc)

Previous topic

FindProducer

Next topic

FindPython

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindProtobuf

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPython — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPython2" href="FindPython2.html" />
    <link rel="prev" title="FindProtobuf" href="FindProtobuf.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython

FindPython¶

New in version 3.12.

Find Python interpreter, compiler and development environment (include
directories and libraries).

New in version 3.19: When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the find_package() command.

The following components are supported:

Interpreter: search for Python interpreter.

Compiler: search for Python compiler. Only offered by IronPython.

Development: search for development artifacts (include directories and
libraries).

New in version 3.18: This component includes two sub-components which can be specified
independently:

Development.Module: search for artifacts for Python module
developments.

Development.Embed: search for artifacts for Python embedding
developments.

New in version 3.26:

Development.SABIModule: search for artifacts for Python module
developments using the
Stable Application Binary Interface.
This component is available only for version 3.2 and upper.

NumPy: search for NumPy include directories.

New in version 3.14: Added the NumPy component.

If no COMPONENTS are specified, Interpreter is assumed.

If component Development is specified, it implies sub-components
Development.Module and Development.Embed.

To ensure consistent versions between components Interpreter, Compiler,
Development (or one of its sub-components) and NumPy, specify all
components at the same time:

find_package (Python COMPONENTS Interpreter Development)

This module looks preferably for version 3 of Python. If not found, version 2
is searched.
To manage concurrent versions 3 and 2 of Python, use FindPython3 and
FindPython2 modules rather than this one.

Note

If components Interpreter and Development (or one of its
sub-components) are both specified, this module search only for interpreter
with same platform architecture as the one defined by CMake
configuration. This constraint does not apply if only Interpreter
component is specified.

Imported Targets¶

This module defines the following Imported Targets:

Changed in version 3.14: Imported Targets are only created when
CMAKE_ROLE is PROJECT.

Python::Interpreter

Python interpreter. Target defined if component Interpreter is found.

Python::Compiler

Python compiler. Target defined if component Compiler is found.

Python::Module

New in version 3.15.

Python library for Python module. Target defined if component
Development.Module is found.

Python::SABIModule

New in version 3.26.

Python library for Python module using the Stable Application Binary
Interface. Target defined if component Development.SABIModule is found.

Python::Python

Python library for Python embedding. Target defined if component
Development.Embed is found.

Python::NumPy

New in version 3.14.

NumPy Python library. Target defined if component NumPy is found.

Result Variables¶

This module will set the following variables in your project
(see Standard Variable Names):

Python_FOUND

System has the Python requested components.

Python_Interpreter_FOUND

System has the Python interpreter.

Python_EXECUTABLE

Path to the Python interpreter.

Python_INTERPRETER_ID

A short string unique to the interpreter. Possible values include:

Python

ActivePython

Anaconda

Canopy

IronPython

PyPy

Python_STDLIB

Standard platform independent installation directory.

Information returned by sysconfig.get_path('stdlib').

Python_STDARCH

Standard platform dependent installation directory.

Information returned by sysconfig.get_path('platstdlib').

Python_SITELIB

Third-party platform independent installation directory.

Information returned by sysconfig.get_path('purelib').

Python_SITEARCH

Third-party platform dependent installation directory.

Information returned by sysconfig.get_path('platlib').

Python_SOABI

New in version 3.17.

Extension suffix for modules.

Information computed from sysconfig.get_config_var('EXT_SUFFIX') or
sysconfig.get_config_var('SOABI') or
python3-config --extension-suffix.

Python_SOSABI

New in version 3.26.

Extension suffix for modules using the Stable Application Binary Interface.

Information computed from importlib.machinery.EXTENSION_SUFFIXES if the
COMPONENT Interpreter was specified. Otherwise, the extension is abi3
except for Windows, MSYS and CYGWIN for which this is an empty
string.

Python_Compiler_FOUND

System has the Python compiler.

Python_COMPILER

Path to the Python compiler. Only offered by IronPython.

Python_COMPILER_ID

A short string unique to the compiler. Possible values include:

IronPython

Python_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python_Development_FOUND

System has the Python development artifacts.

Python_Development.Module_FOUND

New in version 3.18.

System has the Python development artifacts for Python module.

Python_Development.SABIModule_FOUND

New in version 3.26.

System has the Python development artifacts for Python module using the
Stable Application Binary Interface.

Python_Development.Embed_FOUND

New in version 3.18.

System has the Python development artifacts for Python embedding.

Python_INCLUDE_DIRS

The Python include directories.

Python_LINK_OPTIONS

New in version 3.19.

The Python link options. Some configurations require specific link options
for a correct build and execution.

Python_LIBRARIES

The Python libraries.

Python_LIBRARY_DIRS

The Python library directories.

Python_RUNTIME_LIBRARY_DIRS

The Python runtime library directories.

Python_SABI_LIBRARIES

New in version 3.26.

The Python libraries for the Stable Application Binary Interface.

Python_SABI_LIBRARY_DIRS

New in version 3.26.

The Python SABI library directories.

Python_RUNTIME_SABI_LIBRARY_DIRS

New in version 3.26.

The Python runtime SABI library directories.

Python_VERSION

Python version.

Python_VERSION_MAJOR

Python major version.

Python_VERSION_MINOR

Python minor version.

Python_VERSION_PATCH

Python patch version.

Python_PyPy_VERSION

New in version 3.18.

Python PyPy version.

Python_NumPy_FOUND

New in version 3.14.

System has the NumPy.

Python_NumPy_INCLUDE_DIRS

New in version 3.14.

The NumPy include directories.

Python_NumPy_VERSION

New in version 3.14.

The NumPy version.

Hints¶

Python_ROOT_DIR

Define the root directory of a Python installation.

Python_USE_STATIC_LIBS

If not defined, search for shared libraries and static libraries in that
order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Note

This hint will be ignored on Windows because static libraries are not
available on this platform.

Python_FIND_ABI

New in version 3.16.

This variable defines which ABIs, as defined in PEP 3149, should be
searched.

Note

This hint will be honored only when searched for Python version 3.

Note

If Python_FIND_ABI is not defined, any ABI will be searched.

The Python_FIND_ABI variable is a 3-tuple specifying, in that order,
pydebug (d), pymalloc (m) and unicode (u) flags.
Each element can be set to one of the following:

ON: Corresponding flag is selected.

OFF: Corresponding flag is not selected.

ANY: The two possibilities (ON and OFF) will be searched.

From this 3-tuple, various ABIs will be searched starting from the most
specialized to the most general. Moreover, debug versions will be
searched after non-debug ones.

For example, if we have:

set (Python_FIND_ABI "ON" "ANY" "ANY")

The following flags combinations will be appended, in that order, to the
artifact names: dmu, dm, du, and d.

And to search any possible ABIs:

set (Python_FIND_ABI "ANY" "ANY" "ANY")

The following combinations, in that order, will be used: mu, m,
u, <empty>, dmu, dm, du and d.

Note

This hint is useful only on POSIX systems. So, on Windows systems,
when Python_FIND_ABI is defined, Python distributions from
python.org will be found only if value for
each flag is OFF or ANY.

Python_FIND_STRATEGY

New in version 3.15.

This variable defines how lookup will be done.
The Python_FIND_STRATEGY variable can be set to one of the following:

VERSION: Try to find the most recent version in all specified
locations.
This is the default if policy CMP0094 is undefined or set to
OLD.

LOCATION: Stops lookup as soon as a version satisfying version
constraints is founded.
This is the default if policy CMP0094 is set to NEW.

See also Python_FIND_UNVERSIONED_NAMES.

Python_FIND_REGISTRY

New in version 3.13.

On Windows the Python_FIND_REGISTRY variable determine the order
of preference between registry and environment variables.
the Python_FIND_REGISTRY variable can be set to one of the following:

FIRST: Try to use registry before environment variables.
This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

Python_FIND_FRAMEWORK

New in version 3.15.

On macOS the Python_FIND_FRAMEWORK variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as CMAKE_FIND_FRAMEWORK
variable.

Note

Value ONLY is not supported so FIRST will be used instead.

If Python_FIND_FRAMEWORK is not defined, CMAKE_FIND_FRAMEWORK
variable will be used, if any.

Python_FIND_VIRTUALENV

New in version 3.15.

This variable defines the handling of virtual environments managed by
virtualenv or conda. It is meaningful only when a virtual environment
is active (i.e. the activate script has been evaluated). In this case, it
takes precedence over Python_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK
variables.  The Python_FIND_VIRTUALENV variable can be set to one of the
following:

FIRST: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.

ONLY: Only the virtual environment is used to look-up for the
interpreter.

STANDARD: The virtual environment is not used to look-up for the
interpreter but environment variable PATH is always considered.
In this case, variable Python_FIND_REGISTRY (Windows) or
CMAKE_FIND_FRAMEWORK (macOS) can be set with value LAST or
NEVER to select preferably the interpreter from the virtual
environment.

New in version 3.17: Added support for conda environments.

Note

If the component Development is requested, it is strongly
recommended to also include the component Interpreter to get expected
result.

Python_FIND_IMPLEMENTATIONS

New in version 3.18.

This variable defines, in an ordered list, the different implementations
which will be searched. The Python_FIND_IMPLEMENTATIONS variable can
hold the following values:

CPython: this is the standard implementation. Various products, like
Anaconda or ActivePython, rely on this implementation.

IronPython: This implementation use the CSharp language for
.NET Framework on top of the Dynamic Language Runtime (DLR).
See IronPython.

PyPy: This implementation use RPython language and
RPython translation toolchain to produce the python interpreter.
See PyPy.

The default value is:

Windows platform: CPython, IronPython

Other platforms: CPython

Note

This hint has the lowest priority of all hints, so even if, for example,
you specify IronPython first and CPython in second, a python
product based on CPython can be selected because, for example with
Python_FIND_STRATEGY=LOCATION, each location will be search first for
IronPython and second for CPython.

Note

When IronPython is specified, on platforms other than Windows, the
.Net interpreter (i.e. mono command) is expected to be available
through the PATH variable.

Python_FIND_UNVERSIONED_NAMES

New in version 3.20.

This variable defines how the generic names will be searched. Currently, it
only applies to the generic names of the interpreter, namely, python3 or
python2 and python.
The Python_FIND_UNVERSIONED_NAMES variable can be set to one of the
following values:

FIRST: The generic names are searched before the more specialized ones
(such as python2.5 for example).

LAST: The generic names are searched after the more specialized ones.
This is the default.

NEVER: The generic name are not searched at all.

See also Python_FIND_STRATEGY.

Artifacts Specification¶

New in version 3.16.

To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:

Python_EXECUTABLE

The path to the interpreter.

Python_COMPILER

The path to the compiler.

Python_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python_LIBRARY

The path to the library. It will be used to compute the
variables Python_LIBRARIES, Python_LIBRARY_DIRS and
Python_RUNTIME_LIBRARY_DIRS.

Python_SABI_LIBRARY

New in version 3.26.

The path to the library for Stable Application Binary Interface. It will be
used to compute the variables Python_SABI_LIBRARIES,
Python_SABI_LIBRARY_DIRS and Python_RUNTIME_SABI_LIBRARY_DIRS.

Python_INCLUDE_DIR

The path to the directory of the Python headers. It will be used to
compute the variable Python_INCLUDE_DIRS.

Python_NumPy_INCLUDE_DIR

The path to the directory of the NumPy headers. It will be used to
compute the variable Python_NumPy_INCLUDE_DIRS.

Note

All paths must be absolute. Any artifact specified with a relative path
will be ignored.

Note

When an artifact is specified, all HINTS will be ignored and no search
will be performed for this artifact.

If more than one artifact is specified, it is the user's responsibility to
ensure the consistency of the various artifacts.

By default, this module supports multiple calls in different directories of a
project with different version/component requirements while providing correct
and consistent results for each call. To support this behavior, CMake cache
is not used in the traditional way which can be problematic for interactive
specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:

Python_ARTIFACTS_INTERACTIVE

New in version 3.18.

Selects the behavior of the module. This is a boolean variable:

If set to TRUE: Create CMake cache entries for the above artifact
specification variables so that users can edit them interactively.
This disables support for multiple version/component requirements.

If set to FALSE or undefined: Enable multiple version/component
requirements.

Commands¶

This module defines the command Python_add_library (when
CMAKE_ROLE is PROJECT), which has the same semantics as
add_library() and adds a dependency to target Python::Python or,
when library type is MODULE, to target Python::Module or
Python::SABIModule (when USE_SABI option is specified) and takes care
of Python module naming rules:

Python_add_library (<name> [STATIC | SHARED | MODULE [USE_SABI <version>] [WITH_SOABI]]
                    <source1> [<source2> ...])

If the library type is not specified, MODULE is assumed.

New in version 3.17: For MODULE library type, if option WITH_SOABI is specified, the
module suffix will include the Python_SOABI value, if any.

New in version 3.26: For MODULE type, if the option USE_SABI is specified, the
preprocessor definition Py_LIMITED_API will be specified, as PRIVATE,
for the target <name> with the value computed from <version> argument.
The expected format for <version> is major[.minor], where each
component is a numeric value. If minor component is specified, the
version should be, at least, 3.2 which is the version where the
Stable Application Binary Interface
was introduced. Specifying only major version 3 is equivalent to 3.2.

When option WITH_SOABI is also specified,  the module suffix will include
the Python_SOSABI value, if any.

Table of Contents

FindPython

Imported Targets

Result Variables

Hints

Artifacts Specification

Commands

Previous topic

FindProtobuf

Next topic

FindPython2

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPython2 — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPython3" href="FindPython3.html" />
    <link rel="prev" title="FindPython" href="FindPython.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython2

FindPython2¶

New in version 3.12.

Find Python 2 interpreter, compiler and development environment (include
directories and libraries).

New in version 3.19: When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the find_package() command.

The following components are supported:

Interpreter: search for Python 2 interpreter

Compiler: search for Python 2 compiler. Only offered by IronPython.

Development: search for development artifacts (include directories and
libraries).

New in version 3.18: This component includes two sub-components which can be specified
independently:

Development.Module: search for artifacts for Python 2 module
developments.

Development.Embed: search for artifacts for Python 2 embedding
developments.

NumPy: search for NumPy include directories.

New in version 3.14: Added the NumPy component.

If no COMPONENTS are specified, Interpreter is assumed.

If component Development is specified, it implies sub-components
Development.Module and Development.Embed.

To ensure consistent versions between components Interpreter, Compiler,
Development (or one of its sub-components) and NumPy, specify all
components at the same time:

find_package (Python2 COMPONENTS Interpreter Development)

This module looks only for version 2 of Python. This module can be used
concurrently with FindPython3 module to use both Python versions.

The FindPython module can be used if Python version does not matter
for you.

Note

If components Interpreter and Development (or one of its
sub-components) are both specified, this module search only for interpreter
with same platform architecture as the one defined by CMake
configuration. This constraint does not apply if only Interpreter
component is specified.

Imported Targets¶

This module defines the following Imported Targets:

Changed in version 3.14: Imported Targets are only created when
CMAKE_ROLE is PROJECT.

Python2::Interpreter

Python 2 interpreter. Target defined if component Interpreter is found.

Python2::Compiler

Python 2 compiler. Target defined if component Compiler is found.

Python2::Module

New in version 3.15.

Python 2 library for Python module. Target defined if component
Development.Module is found.

Python2::Python

Python 2 library for Python embedding. Target defined if component
Development.Embed is found.

Python2::NumPy

New in version 3.14.

NumPy library for Python 2. Target defined if component NumPy is found.

Result Variables¶

This module will set the following variables in your project
(see Standard Variable Names):

Python2_FOUND

System has the Python 2 requested components.

Python2_Interpreter_FOUND

System has the Python 2 interpreter.

Python2_EXECUTABLE

Path to the Python 2 interpreter.

Python2_INTERPRETER_ID

A short string unique to the interpreter. Possible values include:

Python

ActivePython

Anaconda

Canopy

IronPython

PyPy

Python2_STDLIB

Standard platform independent installation directory.

Information returned by sysconfig.get_path('stdlib') or else
distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True).

Python2_STDARCH

Standard platform dependent installation directory.

Information returned by sysconfig.get_path('platstdlib') or else
distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True).

Python2_SITELIB

Third-party platform independent installation directory.

Information returned by sysconfig.get_path('purelib') or else
distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False).

Python2_SITEARCH

Third-party platform dependent installation directory.

Information returned by sysconfig.get_path('platlib') or else
distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False).

Python2_Compiler_FOUND

System has the Python 2 compiler.

Python2_COMPILER

Path to the Python 2 compiler. Only offered by IronPython.

Python2_COMPILER_ID

A short string unique to the compiler. Possible values include:

IronPython

Python2_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python2_Development_FOUND

System has the Python 2 development artifacts.

Python2_Development.Module_FOUND

New in version 3.18.

System has the Python 2 development artifacts for Python module.

Python2_Development.Embed_FOUND

New in version 3.18.

System has the Python 2 development artifacts for Python embedding.

Python2_INCLUDE_DIRS

The Python 2 include directories.

Python2_LINK_OPTIONS

New in version 3.19.

The Python 2 link options. Some configurations require specific link options
for a correct build and execution.

Python2_LIBRARIES

The Python 2 libraries.

Python2_LIBRARY_DIRS

The Python 2 library directories.

Python2_RUNTIME_LIBRARY_DIRS

The Python 2 runtime library directories.

Python2_VERSION

Python 2 version.

Python2_VERSION_MAJOR

Python 2 major version.

Python2_VERSION_MINOR

Python 2 minor version.

Python2_VERSION_PATCH

Python 2 patch version.

Python2_PyPy_VERSION

New in version 3.18.

Python 2 PyPy version.

Python2_NumPy_FOUND

New in version 3.14.

System has the NumPy.

Python2_NumPy_INCLUDE_DIRS

New in version 3.14.

The NumPy include directories.

Python2_NumPy_VERSION

New in version 3.14.

The NumPy version.

Hints¶

Python2_ROOT_DIR

Define the root directory of a Python 2 installation.

Python2_USE_STATIC_LIBS

If not defined, search for shared libraries and static libraries in that
order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Note

This hint will be ignored on Windows because static libraries are not
available on this platform.

Python2_FIND_STRATEGY

New in version 3.15.

This variable defines how lookup will be done.
The Python2_FIND_STRATEGY variable can be set to one of the following:

VERSION: Try to find the most recent version in all specified
locations.
This is the default if policy CMP0094 is undefined or set to
OLD.

LOCATION: Stops lookup as soon as a version satisfying version
constraints is founded.
This is the default if policy CMP0094 is set to NEW.

See also Python2_FIND_UNVERSIONED_NAMES.

Python2_FIND_REGISTRY

New in version 3.13.

On Windows the Python2_FIND_REGISTRY variable determine the order
of preference between registry and environment variables.
the Python2_FIND_REGISTRY variable can be set to one of the following:

FIRST: Try to use registry before environment variables.
This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

Python2_FIND_FRAMEWORK

New in version 3.15.

On macOS the Python2_FIND_FRAMEWORK variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as CMAKE_FIND_FRAMEWORK
variable.

Note

Value ONLY is not supported so FIRST will be used instead.

If Python2_FIND_FRAMEWORK is not defined, CMAKE_FIND_FRAMEWORK
variable will be used, if any.

Python2_FIND_VIRTUALENV

New in version 3.15.

This variable defines the handling of virtual environments managed by
virtualenv or conda. It is meaningful only when a virtual environment
is active (i.e. the activate script has been evaluated). In this case, it
takes precedence over Python2_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK
variables.  The Python2_FIND_VIRTUALENV variable can be set to one of the
following:

FIRST: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.

ONLY: Only the virtual environment is used to look-up for the
interpreter.

STANDARD: The virtual environment is not used to look-up for the
interpreter but environment variable PATH is always considered.
In this case, variable Python2_FIND_REGISTRY (Windows) or
CMAKE_FIND_FRAMEWORK (macOS) can be set with value LAST or
NEVER to select preferably the interpreter from the virtual
environment.

New in version 3.17: Added support for conda environments.

Note

If the component Development is requested, it is strongly
recommended to also include the component Interpreter to get expected
result.

Python2_FIND_IMPLEMENTATIONS

New in version 3.18.

This variable defines, in an ordered list, the different implementations
which will be searched. The Python2_FIND_IMPLEMENTATIONS variable can
hold the following values:

CPython: this is the standard implementation. Various products, like
Anaconda or ActivePython, rely on this implementation.

IronPython: This implementation use the CSharp language for
.NET Framework on top of the Dynamic Language Runtime (DLR).
See IronPython.

PyPy: This implementation use RPython language and
RPython translation toolchain to produce the python interpreter.
See PyPy.

The default value is:

Windows platform: CPython, IronPython

Other platforms: CPython

Note

This hint has the lowest priority of all hints, so even if, for example,
you specify IronPython first and CPython in second, a python
product based on CPython can be selected because, for example with
Python2_FIND_STRATEGY=LOCATION, each location will be search first for
IronPython and second for CPython.

Note

When IronPython is specified, on platforms other than Windows, the
.Net interpreter (i.e. mono command) is expected to be available
through the PATH variable.

Python2_FIND_UNVERSIONED_NAMES

New in version 3.20.

This variable defines how the generic names will be searched. Currently, it
only applies to the generic names of the interpreter, namely, python2 and
python.
The Python2_FIND_UNVERSIONED_NAMES variable can be set to one of the
following values:

FIRST: The generic names are searched before the more specialized ones
(such as python2.5 for example).

LAST: The generic names are searched after the more specialized ones.
This is the default.

NEVER: The generic name are not searched at all.

See also Python2_FIND_STRATEGY.

Artifacts Specification¶

New in version 3.16.

To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:

Python2_EXECUTABLE

The path to the interpreter.

Python2_COMPILER

The path to the compiler.

Python2_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python2_LIBRARY

The path to the library. It will be used to compute the
variables Python2_LIBRARIES, Python2_LIBRARY_DIRS and
Python2_RUNTIME_LIBRARY_DIRS.

Python2_INCLUDE_DIR

The path to the directory of the Python headers. It will be used to
compute the variable Python2_INCLUDE_DIRS.

Python2_NumPy_INCLUDE_DIR

The path to the directory of the NumPy headers. It will be used to
compute the variable Python2_NumPy_INCLUDE_DIRS.

Note

All paths must be absolute. Any artifact specified with a relative path
will be ignored.

Note

When an artifact is specified, all HINTS will be ignored and no search
will be performed for this artifact.

If more than one artifact is specified, it is the user's responsibility to
ensure the consistency of the various artifacts.

By default, this module supports multiple calls in different directories of a
project with different version/component requirements while providing correct
and consistent results for each call. To support this behavior, CMake cache
is not used in the traditional way which can be problematic for interactive
specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:

Python2_ARTIFACTS_INTERACTIVE

New in version 3.18.

Selects the behavior of the module. This is a boolean variable:

If set to TRUE: Create CMake cache entries for the above artifact
specification variables so that users can edit them interactively.
This disables support for multiple version/component requirements.

If set to FALSE or undefined: Enable multiple version/component
requirements.

Commands¶

This module defines the command Python2_add_library (when
CMAKE_ROLE is PROJECT), which has the same semantics as
add_library() and adds a dependency to target Python2::Python or,
when library type is MODULE, to target Python2::Module and takes care
of Python module naming rules:

Python2_add_library (<name> [STATIC | SHARED | MODULE]
                     <source1> [<source2> ...])

If library type is not specified, MODULE is assumed.

Table of Contents

FindPython2

Imported Targets

Result Variables

Hints

Artifacts Specification

Commands

Previous topic

FindPython

Next topic

FindPython3

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython2

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPython3 — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindQt3" href="FindQt3.html" />
    <link rel="prev" title="FindPython2" href="FindPython2.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython3

FindPython3¶

New in version 3.12.

Find Python 3 interpreter, compiler and development environment (include
directories and libraries).

New in version 3.19: When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the find_package() command.

The following components are supported:

Interpreter: search for Python 3 interpreter

Compiler: search for Python 3 compiler. Only offered by IronPython.

Development: search for development artifacts (include directories and
libraries).

New in version 3.18: This component includes two sub-components which can be specified
independently:

Development.Module: search for artifacts for Python 3 module
developments.

Development.Embed: search for artifacts for Python 3 embedding
developments.

New in version 3.26:

Development.SABIModule: search for artifacts for Python 3 module
developments using the
Stable Application Binary Interface.
This component is available only for version 3.2 and upper.

NumPy: search for NumPy include directories.

New in version 3.14: Added the NumPy component.

If no COMPONENTS are specified, Interpreter is assumed.

If component Development is specified, it implies sub-components
Development.Module and Development.Embed.

To ensure consistent versions between components Interpreter, Compiler,
Development (or one of its sub-components) and NumPy, specify all
components at the same time:

find_package (Python3 COMPONENTS Interpreter Development)

This module looks only for version 3 of Python. This module can be used
concurrently with FindPython2 module to use both Python versions.

The FindPython module can be used if Python version does not matter
for you.

Note

If components Interpreter and Development (or one of its
sub-components) are both specified, this module search only for interpreter
with same platform architecture as the one defined by CMake
configuration. This constraint does not apply if only Interpreter
component is specified.

Imported Targets¶

This module defines the following Imported Targets:

Changed in version 3.14: Imported Targets are only created when
CMAKE_ROLE is PROJECT.

Python3::Interpreter

Python 3 interpreter. Target defined if component Interpreter is found.

Python3::Compiler

Python 3 compiler. Target defined if component Compiler is found.

Python3::Module

New in version 3.15.

Python 3 library for Python module. Target defined if component
Development.Module is found.

Python3::SABIModule

New in version 3.26.

Python 3 library for Python module using the Stable Application Binary
Interface. Target defined if component Development.SABIModule is found.

Python3::Python

Python 3 library for Python embedding. Target defined if component
Development.Embed is found.

Python3::NumPy

New in version 3.14.

NumPy library for Python 3. Target defined if component NumPy is found.

Result Variables¶

This module will set the following variables in your project
(see Standard Variable Names):

Python3_FOUND

System has the Python 3 requested components.

Python3_Interpreter_FOUND

System has the Python 3 interpreter.

Python3_EXECUTABLE

Path to the Python 3 interpreter.

Python3_INTERPRETER_ID

A short string unique to the interpreter. Possible values include:

Python

ActivePython

Anaconda

Canopy

IronPython

PyPy

Python3_STDLIB

Standard platform independent installation directory.

Information returned by sysconfig.get_path('stdlib').

Python3_STDARCH

Standard platform dependent installation directory.

Information returned by sysconfig.get_path('platstdlib').

Python3_SITELIB

Third-party platform independent installation directory.

Information returned by sysconfig.get_path('purelib').

Python3_SITEARCH

Third-party platform dependent installation directory.

Information returned by sysconfig.get_path('platlib').

Python3_SOABI

New in version 3.17.

Extension suffix for modules.

Information computed from sysconfig.get_config_var('EXT_SUFFIX') or
sysconfig.get_config_var('SOABI') or
python3-config --extension-suffix.

Python3_SOSABI

New in version 3.26.

Extension suffix for modules using the Stable Application Binary Interface.

Information computed from importlib.machinery.EXTENSION_SUFFIXES if the
COMPONENT Interpreter was specified. Otherwise, the extension is abi3
except for Windows, MSYS and CYGWIN for which this is an empty
string.

Python3_Compiler_FOUND

System has the Python 3 compiler.

Python3_COMPILER

Path to the Python 3 compiler. Only offered by IronPython.

Python3_COMPILER_ID

A short string unique to the compiler. Possible values include:

IronPython

Python3_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python3_Development_FOUND

System has the Python 3 development artifacts.

Python3_Development.Module_FOUND

New in version 3.18.

System has the Python 3 development artifacts for Python module.

Python3_Development.SABIModule_FOUND

New in version 3.26.

System has the Python 3 development artifacts for Python module using the
Stable Application Binary Interface.

Python3_Development.Embed_FOUND

New in version 3.18.

System has the Python 3 development artifacts for Python embedding.

Python3_INCLUDE_DIRS

The Python 3 include directories.

Python3_LINK_OPTIONS

New in version 3.19.

The Python 3 link options. Some configurations require specific link options
for a correct build and execution.

Python3_LIBRARIES

The Python 3 libraries.

Python3_LIBRARY_DIRS

The Python 3 library directories.

Python3_RUNTIME_LIBRARY_DIRS

The Python 3 runtime library directories.

Python3_SABI_LIBRARIES

New in version 3.26.

The Python 3 libraries for the Stable Application Binary Interface.

Python3_SABI_LIBRARY_DIRS

New in version 3.26.

The Python 3 SABI library directories.

Python3_RUNTIME_SABI_LIBRARY_DIRS

New in version 3.26.

The Python 3 runtime SABI library directories.

Python3_VERSION

Python 3 version.

Python3_VERSION_MAJOR

Python 3 major version.

Python3_VERSION_MINOR

Python 3 minor version.

Python3_VERSION_PATCH

Python 3 patch version.

Python3_PyPy_VERSION

New in version 3.18.

Python 3 PyPy version.

Python3_NumPy_FOUND

New in version 3.14.

System has the NumPy.

Python3_NumPy_INCLUDE_DIRS

New in version 3.14.

The NumPy include directories.

Python3_NumPy_VERSION

New in version 3.14.

The NumPy version.

Hints¶

Python3_ROOT_DIR

Define the root directory of a Python 3 installation.

Python3_USE_STATIC_LIBS

If not defined, search for shared libraries and static libraries in that
order.

If set to TRUE, search only for static libraries.

If set to FALSE, search only for shared libraries.

Note

This hint will be ignored on Windows because static libraries are not
available on this platform.

Python3_FIND_ABI

New in version 3.16.

This variable defines which ABIs, as defined in PEP 3149, should be
searched.

Note

If Python3_FIND_ABI is not defined, any ABI will be searched.

The Python3_FIND_ABI variable is a 3-tuple specifying, in that order,
pydebug (d), pymalloc (m) and unicode (u) flags.
Each element can be set to one of the following:

ON: Corresponding flag is selected.

OFF: Corresponding flag is not selected.

ANY: The two possibilities (ON and OFF) will be searched.

From this 3-tuple, various ABIs will be searched starting from the most
specialized to the most general. Moreover, debug versions will be
searched after non-debug ones.

For example, if we have:

set (Python3_FIND_ABI "ON" "ANY" "ANY")

The following flags combinations will be appended, in that order, to the
artifact names: dmu, dm, du, and d.

And to search any possible ABIs:

set (Python3_FIND_ABI "ANY" "ANY" "ANY")

The following combinations, in that order, will be used: mu, m,
u, <empty>, dmu, dm, du and d.

Note

This hint is useful only on POSIX systems. So, on Windows systems,
when Python3_FIND_ABI is defined, Python distributions from
python.org will be found only if value for
each flag is OFF or ANY.

Python3_FIND_STRATEGY

New in version 3.15.

This variable defines how lookup will be done.
The Python3_FIND_STRATEGY variable can be set to one of the following:

VERSION: Try to find the most recent version in all specified
locations.
This is the default if policy CMP0094 is undefined or set to
OLD.

LOCATION: Stops lookup as soon as a version satisfying version
constraints is founded.
This is the default if policy CMP0094 is set to NEW.

See also Python3_FIND_UNVERSIONED_NAMES.

Python3_FIND_REGISTRY

New in version 3.13.

On Windows the Python3_FIND_REGISTRY variable determine the order
of preference between registry and environment variables.
The Python3_FIND_REGISTRY variable can be set to one of the following:

FIRST: Try to use registry before environment variables.
This is the default.

LAST: Try to use registry after environment variables.

NEVER: Never try to use registry.

Python3_FIND_FRAMEWORK

New in version 3.15.

On macOS the Python3_FIND_FRAMEWORK variable determine the order of
preference between Apple-style and unix-style package components.
This variable can take same values as CMAKE_FIND_FRAMEWORK
variable.

Note

Value ONLY is not supported so FIRST will be used instead.

If Python3_FIND_FRAMEWORK is not defined, CMAKE_FIND_FRAMEWORK
variable will be used, if any.

Python3_FIND_VIRTUALENV

New in version 3.15.

This variable defines the handling of virtual environments managed by
virtualenv or conda. It is meaningful only when a virtual environment
is active (i.e. the activate script has been evaluated). In this case, it
takes precedence over Python3_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK
variables.  The Python3_FIND_VIRTUALENV variable can be set to one of the
following:

FIRST: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default.

ONLY: Only the virtual environment is used to look-up for the
interpreter.

STANDARD: The virtual environment is not used to look-up for the
interpreter but environment variable PATH is always considered.
In this case, variable Python3_FIND_REGISTRY (Windows) or
CMAKE_FIND_FRAMEWORK (macOS) can be set with value LAST or
NEVER to select preferably the interpreter from the virtual
environment.

New in version 3.17: Added support for conda environments.

Note

If the component Development is requested, it is strongly
recommended to also include the component Interpreter to get expected
result.

Python3_FIND_IMPLEMENTATIONS

New in version 3.18.

This variable defines, in an ordered list, the different implementations
which will be searched. The Python3_FIND_IMPLEMENTATIONS variable can
hold the following values:

CPython: this is the standard implementation. Various products, like
Anaconda or ActivePython, rely on this implementation.

IronPython: This implementation use the CSharp language for
.NET Framework on top of the Dynamic Language Runtime (DLR).
See IronPython.

PyPy: This implementation use RPython language and
RPython translation toolchain to produce the python interpreter.
See PyPy.

The default value is:

Windows platform: CPython, IronPython

Other platforms: CPython

Note

This hint has the lowest priority of all hints, so even if, for example,
you specify IronPython first and CPython in second, a python
product based on CPython can be selected because, for example with
Python3_FIND_STRATEGY=LOCATION, each location will be search first for
IronPython and second for CPython.

Note

When IronPython is specified, on platforms other than Windows, the
.Net interpreter (i.e. mono command) is expected to be available
through the PATH variable.

Python3_FIND_UNVERSIONED_NAMES

New in version 3.20.

This variable defines how the generic names will be searched. Currently, it
only applies to the generic names of the interpreter, namely, python3 and
python.
The Python3_FIND_UNVERSIONED_NAMES variable can be set to one of the
following values:

FIRST: The generic names are searched before the more specialized ones
(such as python3.5 for example).

LAST: The generic names are searched after the more specialized ones.
This is the default.

NEVER: The generic name are not searched at all.

See also Python3_FIND_STRATEGY.

Artifacts Specification¶

New in version 3.16.

To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:

Python3_EXECUTABLE

The path to the interpreter.

Python3_COMPILER

The path to the compiler.

Python3_DOTNET_LAUNCHER

New in version 3.18.

The .Net interpreter. Only used by IronPython implementation.

Python3_LIBRARY

The path to the library. It will be used to compute the
variables Python3_LIBRARIES, Python3_LIBRARY_DIRS and
Python3_RUNTIME_LIBRARY_DIRS.

Python3_SABI_LIBRARY

New in version 3.26.

The path to the library for Stable Application Binary Interface. It will be
used to compute the variables Python3_SABI_LIBRARIES,
Python3_SABI_LIBRARY_DIRS and Python3_RUNTIME_SABI_LIBRARY_DIRS.

Python3_INCLUDE_DIR

The path to the directory of the Python headers. It will be used to
compute the variable Python3_INCLUDE_DIRS.

Python3_NumPy_INCLUDE_DIR

The path to the directory of the NumPy headers. It will be used to
compute the variable Python3_NumPy_INCLUDE_DIRS.

Note

All paths must be absolute. Any artifact specified with a relative path
will be ignored.

Note

When an artifact is specified, all HINTS will be ignored and no search
will be performed for this artifact.

If more than one artifact is specified, it is the user's responsibility to
ensure the consistency of the various artifacts.

By default, this module supports multiple calls in different directories of a
project with different version/component requirements while providing correct
and consistent results for each call. To support this behavior, CMake cache
is not used in the traditional way which can be problematic for interactive
specification. So, to enable also interactive specification, module behavior
can be controlled with the following variable:

Python3_ARTIFACTS_INTERACTIVE

New in version 3.18.

Selects the behavior of the module. This is a boolean variable:

If set to TRUE: Create CMake cache entries for the above artifact
specification variables so that users can edit them interactively.
This disables support for multiple version/component requirements.

If set to FALSE or undefined: Enable multiple version/component
requirements.

Commands¶

This module defines the command Python3_add_library (when
CMAKE_ROLE is PROJECT), which has the same semantics as
add_library() and adds a dependency to target Python3::Python or,
when library type is MODULE, to target Python3::Module or
Python3::SABIModule (when USE_SABI option is specified) and takes care
of Python module naming rules:

Python3_add_library (<name> [STATIC | SHARED | MODULE [USE_SABI <version>] [WITH_SOABI]]
                     <source1> [<source2> ...])

If the library type is not specified, MODULE is assumed.

New in version 3.17: For MODULE library type, if option WITH_SOABI is specified, the
module suffix will include the Python3_SOABI value, if any.

New in version 3.26: For MODULE type, if the option USE_SABI is specified, the
preprocessor definition Py_LIMITED_API will be specified, as PRIVATE,
for the target <name> with the value computed from <version> argument.
The expected format for <version> is major[.minor], where each
component is a numeric value. If minor component is specified, the
version should be, at least, 3.2 which is the version where the
Stable Application Binary Interface
was introduced. Specifying only major version 3 is equivalent to 3.2.

When option WITH_SOABI is also specified,  the module suffix will include
the Python3_SOSABI value, if any.

Table of Contents

FindPython3

Imported Targets

Result Variables

Hints

Artifacts Specification

Commands

Previous topic

FindPython2

Next topic

FindQt3

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPython3

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPythonInterp — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindPythonLibs" href="FindPythonLibs.html" />
    <link rel="prev" title="FindITK" href="FindITK.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPythonInterp

FindPythonInterp¶

Changed in version 3.27: This module is available only if policy CMP0148 is not set to NEW.

Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

Find python interpreter

This module finds if Python interpreter is installed and determines
where the executables are.  This code sets the following variables:

PYTHONINTERP_FOUND         - Was the Python executable found
PYTHON_EXECUTABLE          - path to the Python interpreter

PYTHON_VERSION_STRING      - Python version found e.g. 2.5.2
PYTHON_VERSION_MAJOR       - Python major version found e.g. 2
PYTHON_VERSION_MINOR       - Python minor version found e.g. 5
PYTHON_VERSION_PATCH       - Python patch version found e.g. 2

The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
of version numbers that should be taken into account when searching
for Python.  You need to set this variable before calling
find_package(PythonInterp).

If calling both find_package(PythonInterp) and
find_package(PythonLibs), call find_package(PythonInterp) first to
get the currently active Python version by default with a consistent version
of PYTHON_LIBRARIES.

Note

A call to find_package(PythonInterp ${V}) for python version V
may find a python executable with no version suffix.  In this case
no attempt is made to avoid python executables from other versions.
Use FindPython3, FindPython2 or FindPython
instead.

Previous topic

FindITK

Next topic

FindPythonLibs

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPythonInterp

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>FindPythonLibs — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindQt" href="FindQt.html" />
    <link rel="prev" title="FindPythonInterp" href="FindPythonInterp.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPythonLibs

FindPythonLibs¶

Changed in version 3.27: This module is available only if policy CMP0148 is not set to NEW.

Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

Find python libraries

This module finds if Python is installed and determines where the
include files and libraries are.  It also determines what the name of
the library is.  This code sets the following variables:

PYTHONLIBS_FOUND           - have the Python libs been found
PYTHON_LIBRARIES           - path to the python library
PYTHON_INCLUDE_PATH        - path to where Python.h is found (deprecated)
PYTHON_INCLUDE_DIRS        - path to where Python.h is found
PYTHON_DEBUG_LIBRARIES     - path to the debug library (deprecated)
PYTHONLIBS_VERSION_STRING  - version of the Python libs found (since CMake 2.8.8)

The Python_ADDITIONAL_VERSIONS variable can be used to specify a list
of version numbers that should be taken into account when searching
for Python.  You need to set this variable before calling
find_package(PythonLibs).

If you'd like to specify the installation of Python to use, you should
modify the following cache variables:

PYTHON_LIBRARY             - path to the python library
PYTHON_INCLUDE_DIR         - path to where Python.h is found

If calling both find_package(PythonInterp) and
find_package(PythonLibs), call find_package(PythonInterp) first to
get the currently active Python version by default with a consistent version
of PYTHON_LIBRARIES.

Previous topic

FindPythonInterp

Next topic

FindQt

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-modules(7) »

FindPythonLibs

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.