# ============================================================================
# Copyright (c) 2011-2012 University of Pennsylvania
# Copyright (c) 2013-2014 Andreas Schuh
# All rights reserved.
#
# See COPYING file for license information or visit
# http://opensource.andreasschuh.com/cmake-basis/download.html#license
# ============================================================================
##############################################################################
# @file FindPythonModules.cmake
# @brief Find Python modules.
#
# @par Input/Output variables:
#
#
# @tp @b PythonModules_FIND_COMPONENTS @endtp
# The @c COMPONENTS argument(s) of the find_package() command specifies
# the names of the Python modules to look for. |
#
#
# @tp @b PythonModules_FIND_OPTIONAL_COMPONENTS @endtp
# The @c OPTIONAL_COMPONENTS argument(s) of the find_package() command
# specifies the names of the Python modules which are not necessarily
# required, but should be searched as well. |
#
#
# @tp @b PYTHON_EXECUTABLE @endtp
# Path to the Python interpreter. Should be set by first looking
# for the Python interpreter, i.e., find_packages(PythonInterp).
# If set, this module first tries to execute the Python interpreter,
# import the respective Python module, and then derive the search path
# from the @c __file__ attribute of the loaded Python module.
# Otherwise, or if this fails, it looks either for a package
# @c __init__.py file inside a subdirectory named after the specified
# Python module or a @c .py module file in each directory listed in
# the @c PYTHONPATH. |
#
#
# @tp @b PYTHONPATH @endtp
# Search path for Python modules. If this CMake variable is undefined,
# the corresponding environment variable is used instead if set.
# Only absolute paths in the @c PYTHONPATH are considered. |
#
#
#
# @par Output variables:
#
#
# @tp @b PythonModules_FOUND @endtp
# Whether all specified Python modules were found. |
#
#
# @tp @b PythonModules_<module>_FOUND @endtp
# Whether the Python module <module%gt; was found. |
#
#
# @tp @b PythonModules_<module>_PATH @endtp
# Absolute path of the directory containing the Python module named <module%gt;. |
#
#
# @tp @b PythonModules_<module> @endtp
# Import target for module named <module>. The location of the
# target is @c PythonModules_<module>_PATH. |
#
#
# @tp @b PythonModules_PYTHONPATH @endtp
# The @c PYTHONPATH setting required for the found Python module(s), i.e.,
# The directories that have to be added to the Python search path.
# To support the use of this CMake module more than once with different
# arguments to the find_package() command, e.g., with and without the
# @c REQUIRED argument, the directories containing the found Python
# modules are appended to any existing directories in
# @c PythonModules_PYTHONPATH if not already listed. |
#
#
#
# @ingroup CMakeFindModules
##############################################################################
include (CMakeParseArguments)
# ----------------------------------------------------------------------------
## @brief Find Python module.
#
# If the @c PYTHON_EXECUTABLE variable is set, this function at first tries
# to launch the Python interpreter, import the named Python module, and then
# determines the search path for the Python module from the @c __file__
# attribute of the loaded module. Otherwise, or if this fails, it looks for
# the Python module in the directories listed in the @c PYTHONPATH variable
# if defined. If this variable is not defined, the @c PYTHONPATH environment
# variable is used instead.
#
# @param [in] CACHEVAR Name of CMake cache variable which stores path of
# directory of the Python module. If not set or if
# the cache entry contains space characters only or
# ends in the string NOTFOUND, this function looks for
# the specified Python module. Otherwise, it does nothing
# and leaves the cache entry unmodified.
# @param [in] ARGN The remaining arguments are parsed and the following
# options extract:
# @par
#