4 # SPHINX_EXECUTABLE - path to the Sphinx executable
5 # SPHINX_PYTHONPATH - path to the Sphinx Python modules
8 # Sphinx_EXTENSIONS - optional variable which can be used to specify
9 # a list of required Sphinx extensions; not found
10 # extensions will be reported during the detection
11 # procedure; by default this variable is empty.
13 # set(Sphinx_EXTENSIONS sphinxcontrib.napoleon)
15 ###########################################################################
16 # Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
18 # This library is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU Lesser General Public
20 # License as published by the Free Software Foundation; either
21 # version 2.1 of the License, or (at your option) any later version.
23 # This library is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 # Lesser General Public License for more details.
28 # You should have received a copy of the GNU Lesser General Public
29 # License along with this library; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
35 FIND_PROGRAM(SPHINX_EXECUTABLE
36 NAMES sphinx-build sphinx-build-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
37 PATH_SUFFIXES Scripts)
38 FIND_PROGRAM(SPHINX_APIDOC_EXECUTABLE
39 NAMES sphinx-apidoc sphinx-apidoc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
40 PATH_SUFFIXES Scripts)
41 FIND_PROGRAM(SPHINX_INTL_EXECUTABLE
42 NAMES sphinx-intl sphinx-intl-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
43 PATH_SUFFIXES Scripts)
46 # Get root dir locally, going up two levels from the exec:
47 GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${SPHINX_EXECUTABLE}" PATH)
48 GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
50 SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/site-packages")
52 SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
55 # Handle the standard arguments of the find_package() command:
56 INCLUDE(FindPackageHandleStandardArgs)
57 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE SPHINX_APIDOC_EXECUTABLE SPHINX_INTL_EXECUTABLE)
59 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print(sphinx.__version__)" OUTPUT_VARIABLE SPHINX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
61 MESSAGE(STATUS "Found Sphinx version ${SPHINX_VERSION}")
63 MESSAGE(STATUS "Found Sphinx (unknown version)")