Salome HOME
CMake: SALOME_PACKAGE_REPORT_AND_CHECK now works if no OPTIONAL package was specified.
[modules/kernel.git] / salome_adm / cmake_files / FindSalomeSphinx.cmake
index 3aa6527e7cb6a6326da144b9a1efe26ade4f2b69..2d26445a94049cc50a1be995b63b97d1a18ea949 100644 (file)
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
+# The caller of this macro might set SPHINX_PYTHONPATH to provide a path to be added in front 
+# of the PYTHONPATH with which the sphinx command should be ran.
+#
+# Note the environment is also overriden in 
+#     doc/docutils/CMakeLists.txt
+# with the creation of a dedicated launcher script.
+#
 
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2)
+
+# Also retrieve paths to DOCUTILS and SETUPTOOLS:
+SET(SETUPTOOLS_ROOT_DIR "$ENV{SETUPTOOLS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+SET(DOCUTILS_ROOT_DIR "$ENV{DOCUTILS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+
+# Ensure the command is run with the given PYTHONPATH
+IF(WIN32 AND NOT CYGWIN)
+   MESSAGE(WARNING "Sphinx windows command not re-tested.")
+   SET(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE})
+ELSE()
+   SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$$PYTHONPATH" ${SPHINX_EXECUTABLE})
+ENDIF()
+
 MARK_AS_ADVANCED(SPHINX_EXECUTABLE)