Warning, /frameworks/extra-cmake-modules/cmake/FindSphinx.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2015 Alex Merry <alex.merry@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 FindSphinx
0007 ----------
0008 
0009 Try to find the Sphinx documentation builder.
0010 
0011 This will define the following variables:
0012 
0013 ``Sphinx_FOUND``
0014     True if (the requested version of) Sphinx is available
0015 ``Sphinx_VERSION``
0016     The version of the Sphinx documentation builder.
0017 ``Sphinx_BUILD_EXECUTABLE``
0018     The path to the Sphinx documentation builder executable.
0019 
0020 If ``Sphinx_FOUND`` is TRUE, it will also define the following imported target:
0021 
0022 ``Sphinx::Build``
0023     The Sphinx documentation builder.
0024 
0025 In general we recommend using the imported target, as it is easier to use.
0026 
0027 Since 5.17.0.
0028 #]=======================================================================]
0029 
0030 # Distros sometimes rename Python executables to allow for parallel
0031 # installation of Python2 and Python3 versions
0032 find_program(Sphinx_BUILD_EXECUTABLE
0033     NAMES
0034         sphinx-build
0035         sphinx-build2
0036         sphinx-build3
0037     DOC "Sphinx Documentation Builder (https://www.sphinx-doc.org/)"
0038 )
0039 
0040 if (Sphinx_BUILD_EXECUTABLE)
0041     if(NOT TARGET Sphinx::Build)
0042         add_executable(Sphinx::Build IMPORTED)
0043         set_target_properties(Sphinx::Build PROPERTIES
0044             IMPORTED_LOCATION "${Sphinx_BUILD_EXECUTABLE}"
0045         )
0046     endif()
0047 
0048     execute_process(
0049         COMMAND "${Sphinx_BUILD_EXECUTABLE}" --version
0050         OUTPUT_VARIABLE _Sphinx_version_raw
0051         ERROR_VARIABLE _Sphinx_version_raw
0052     )
0053     if (_Sphinx_version_raw MATCHES "^Sphinx \\([^)]*\\) ([0-9]+(\\.[0-9]+)*)")
0054         set(Sphinx_VERSION "${CMAKE_MATCH_1}")
0055     endif()
0056     unset(_Sphinx_version_raw)
0057 endif()
0058 
0059 include(FindPackageHandleStandardArgs)
0060 find_package_handle_standard_args(Sphinx
0061     FOUND_VAR
0062         Sphinx_FOUND
0063     REQUIRED_VARS
0064         Sphinx_BUILD_EXECUTABLE
0065     VERSION_VAR
0066         Sphinx_VERSION
0067 )
0068 
0069 mark_as_advanced(Sphinx_BUILD_EXECUTABLE)