forked from apple/foundationdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindSphinx.cmake
48 lines (37 loc) · 1.27 KB
/
FindSphinx.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Distributed under the OSI-approved Apache 2.0. See the LICENSE file in
# FoundationDB source code
#[=======================================================================[.rst:
FindSphinx
-------
Find Sphinx, the Python documentation generator
Sphinx_ROOT variable can be used for HINTS for different version of Sphinx.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``Sphinx_EXECUTABLE``
The executable of Sphinx
``Sphinx_FOUND``
If false, Sphinx is not available
#]=======================================================================]
include(FindPackageHandleStandardArgs)
if(NOT Sphinx_ROOT)
set(Sphinx_ROOT $ENV{Sphinx_ROOT})
endif()
find_program(
Sphinx_EXECUTABLE
NAMES sphinx-build
HINTS ${Sphinx_ROOT}
DOC "Sphinx-build tool")
if(Sphinx_EXECUTABLE)
execute_process(
COMMAND ${Sphinx_EXECUTABLE} --version
OUTPUT_VARIABLE _Sphinx_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Strip the leading "sphinx-build " e.g. sphinx-build 5.1.1
string(SUBSTRING ${_Sphinx_VERSION_STRING} 13 -1 Sphinx_VERSION)
endif()
find_package_handle_standard_args(
Sphinx
FOUND_VAR Sphinx_FOUND
REQUIRED_VARS Sphinx_EXECUTABLE Sphinx_VERSION)
mark_as_advanced(Sphinx_FOUND Sphinx_VERSION Sphinx_EXECUTABLE)