1 find_program (SPHINX_EXECUTABLE NAMES sphinx-build 2 HINTS $ENV{SPHINX_DIR} 3 PATH_SUFFIXES bin 4 DOC "Sphinx documentation html generator" 5 ) 6 7 find_program (SPHINX_API_EXECUTABLE NAMES sphinx-apidoc 8 HINTS $ENV{SPHINX_DIR} 9 PATH_SUFFIXES bin 10 DOC "Sphinx documentation rst generator" 11 ) 12 13 include (FindPackageHandleStandardArgs) 14 15 find_package_handle_standard_args (Sphinx DEFAULT_MSG 16 SPHINX_EXECUTABLE 17 SPHINX_API_EXECUTABLE 18 ) 19 20 # Get Sphinx version 21 if (SPHINX_EXECUTABLE) 22 execute_process(COMMAND ${SPHINX_EXECUTABLE} --version 23 OUTPUT_VARIABLE SPHINX_VERSION) 24 if(SPHINX_VERSION) 25 string(REGEX MATCH "([0-9]\\.[0-9]\\.[0-9])" SPHINX_VERSION_STR ${SPHINX_VERSION}) 26 message ("INFO - Sphinx version is " ${SPHINX_VERSION_STR}) 27 endif() 28 endif () 29 30 mark_as_advanced (SPHINX_EXECUTABLE) 31 mark_as_advanced (SPHINX_API_EXECUTABLE) 32