]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
CMake:
authormpa <mpa@opencascade.com>
Fri, 1 Nov 2013 10:44:42 +0000 (10:44 +0000)
committermpa <mpa@opencascade.com>
Fri, 1 Nov 2013 10:44:42 +0000 (10:44 +0000)
Edit documentation. Use salome macros to set the environment for sphinx run.

doc/salome/gui/SMESH/CMakeLists.txt
src/Tools/MGCleanerPlug/doc/CMakeLists.txt
src/Tools/Verima/Doc/CMakeLists.txt
src/Tools/YamsPlug/doc/CMakeLists.txt

index 186f879d69d1e0966563927d42647971a7d9a803..d2f88e1747425fbfac918c8133aa56c169f86514 100644 (file)
@@ -17,8 +17,6 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
-
 SALOME_CONFIGURE_FILE(doxyfile.in doxyfile)
 SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
 SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
@@ -27,44 +25,20 @@ SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/stati
 SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
             
 SET(DOC_SMESH_MeshersList StdMeshers)
-SET(f1 "${CMAKE_CURRENT_SOURCE_DIR}/collect_mesh_methods.py")
-SET(f "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py")
-IF(WIN32)
-  STRING(REPLACE "/" "\\" f ${f})
-  STRING(REPLACE "/" "\\" f1 ${f1})
-  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PYTHONPATH%
-  @SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python\;%PYTHONPATH%
-  @SET PATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PATH%
-  @SET PATH=$ENV{KERNEL_ROOT_DIR}/lib/salome\;%PATH%
-  @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/bin/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/bin/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome\;%PYTHONPATH%
-  @SET SMESH_MeshersList=${DOC_SMESH_MeshersList}
-  ")
-  SET(EXT "bat")
-  SET(CALL_STR "call")
-ELSE(WIN32)
-  SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
-  SET(DOC_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome")
-  SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${DOC_LD_LIBRARY_PATH}:\${LD_LIBRARY_PATH}
-  export SMESH_MeshersList=${DOC_SMESH_MeshersList}
-  ")
-  SET(EXT "sh")
-  SET(CALL_STR ".")
-ENDIF(WIN32)
+SET(smesh_file "${CMAKE_CURRENT_SOURCE_DIR}/collect_mesh_methods.py")
+SET(kernel_file "${KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py")
+
+SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList})
 
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}")
+SET(_cmd_options ${smesh_file} -d -o tmp/smeshBuilder.py StdMeshers)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}")            
 
 ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1
   COMMAND ${CMAKE_COMMAND} -E make_directory tmp2
-  COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp2/smeshBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py
-  COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp2/smesh_algorithm.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py
-  COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp2/StdMeshersBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py
-  COMMAND ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp1/smeshBuilder.py StdMeshers
+  COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/smeshBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py
+  COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/smesh_algorithm.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py
+  COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp2/StdMeshersBuilder.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py
+  COMMAND ${_cmd}
   COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
   COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
   COMMAND ${CMAKE_COMMAND} -E remove_directory tmp1
index 4e9248fd7f7f925d43f6b690c40708343ce944c4..3b635f0ae16bd2e8775322c40b102b3ff959649a 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-# This file mainly prepares the environment in which sphinx should run:
-#  this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
-
-# Prepare Sphinx options
-SET(SPHINXOPTS
-)
-SET(SOURCEDIR
-  ${CMAKE_CURRENT_SOURCE_DIR}
-)
-SET(SPHINXBUILD
-  sphinx-build
-)
-SET(PAPER
-)
-SET(BUILDDIR
-  _build
-)
-SET(CONF_FILE_DIR
-  ${PROJECT_BINARY_DIR}/src/Tools/MGCleanerPlug/doc
-)
-
-# Internal variables
-
-SET(PAPEROPT_a4
-  -D
-  latex_paper_size=a4
-)
-SET(PAPEROPT_letter
-  -D 
-  latex_paper_size=letter
-)
-SET(ALLSPHINXOPTS
-  -d
-  ${BUILDDIR}/doctrees
-  -c 
-  ${CONF_FILE_DIR}
-  ${PAPEROPT_${PAPER}}
-  ${SPHINXOPTS}
-  ${SOURCEDIR}
-)
-
 SALOME_CONFIGURE_FILE(conf.py.in conf.py)
 
-# Write the shell file preparing the env for the Sphinx run:
-#    This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
-#    Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
-
-SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-IF(WIN32)
-  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
-  @SET PYTHONPATH=${HDF5_ROOT_DIR}\\lib\;%PYTHONPATH%
-  @SET PYTHONPATH=${MPI_ROOT_DIR}\\lib\;%PYTHONPATH%
-
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${KERNEL_ROOT_DIR}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
+SET(_cmd_options -c ${PROJECT_BINARY_DIR}/doc/docutils -b html -d doctrees -D latex_paper_size=a4 ${CMAKE_CURRENT_SOURCE_DIR} docutils)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cmd_options}")            
 
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\python\;%PYTHONPATH%
-  @SET PATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PATH%
-  ")
-  SET(EXT "bat")
-  SET(CALL_STR "call")
-ELSE(WIN32)
-  SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-  export PYTHONPATH=${HDF5_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${MPI_ROOT_DIR}/lib:\${PYTHONPATH}
-
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-"
-  )
-  SET(EXT "sh")
-  SET(CALL_STR ".")
-ENDIF(WIN32)
-
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}")
-
-ADD_CUSTOM_TARGET(html_docs_MGCleanerPlug ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${PROJECT_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} docutils)
+ADD_CUSTOM_TARGET(html_docs_MGCleanerPlug COMMAND ${_cmd})
 
 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs_MGCleanerPlug)")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils/ DESTINATION ${SALOME_INSTALL_DOC}/gui/SMESH/MGCleaner)
+
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES docutils)
\ No newline at end of file
index e2b7b51c18b4039792cb448e5a9167290cf57cef..7acdca1a1346b3884c4ea04b43ce79d2ecddd202 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-# This file mainly prepares the environment in which sphinx should run:
-#  this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
+SALOME_CONFIGURE_FILE(conf.py.in conf.py)
 
-# Prepare Sphinx options
-SET(SPHINXOPTS
-)
-SET(SOURCEDIR
-  ${CMAKE_CURRENT_SOURCE_DIR}
-)
-SET(PAPEROPT_a4
-  -D
-  latex_paper_size=a4
-)
-SET(ALLSPHINXOPTS
-  -d
-  doctrees
-  ${PAPEROPT_a4}
-  ${SPHINXOPTS}
-  ${SOURCEDIR}
-)
+SET(_cmd_options -c ${PROJECT_BINARY_DIR}/doc/docutils -b html -d doctrees -D latex_paper_size=a4 ${CMAKE_CURRENT_SOURCE_DIR} docutils)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cmd_options}")            
 
-SALOME_CONFIGURE_FILE(conf.py.in conf.py)                
-
-# Write the shell file preparing the env for the Sphinx run:
-#    This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
-#    Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
-
-SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-IF(WIN32)
-  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
-  @SET PYTHONPATH=${HDF5_ROOT_DIR}\\lib\;%PYTHONPATH%
-  @SET PYTHONPATH=${MPI_ROOT_DIR}\\lib\;%PYTHONPATH%
-
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${KERNEL_ROOT_DIR}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
-
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\python\;%PYTHONPATH%
-  @SET PATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PATH%
-  ")
-  SET(EXT "bat")
-  SET(CALL_STR "call")
-ELSE(WIN32)
-  SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-  export PYTHONPATH=${HDF5_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${MPI_ROOT_DIR}/lib:\${PYTHONPATH}
-
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-"
-  )
-  SET(EXT "sh")
-  SET(CALL_STR ".")
-ENDIF(WIN32)
-
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}")
-
-ADD_CUSTOM_TARGET(html_docs_Verima ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${PROJECT_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} docutils
-)
+ADD_CUSTOM_TARGET(html_docs_Verima COMMAND ${_cmd})
 
 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs_Verima)")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils/ DESTINATION ${SALOME_INSTALL_DOC}/gui/SMESH/Verima)
+
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES docutils)
index a7c38fec0df780b7319a4a6ff950f38b4ab2aa45..1e14e0e2b398d0645d9d96d0330a3e9382765995 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-# This file mainly prepares the environment in which sphinx should run:
-#  this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
+SALOME_CONFIGURE_FILE(conf.py.in conf.py)
 
-# Prepare Sphinx options
-SET(SPHINXOPTS
-)
-SET(SOURCEDIR
-  ${CMAKE_CURRENT_SOURCE_DIR}
-)
-SET(PAPEROPT_a4
-  -D
-  latex_paper_size=a4
-)
-SET(ALLSPHINXOPTS
-  -d
-  doctrees
-  ${PAPEROPT_a4}
-  ${SPHINXOPTS}
-  ${SOURCEDIR}
-)
+SET(_cmd_options -c ${PROJECT_BINARY_DIR}/doc/docutils -b html -d doctrees -D latex_paper_size=a4 ${CMAKE_CURRENT_SOURCE_DIR} docutils)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cmd_options}")            
 
-SALOME_CONFIGURE_FILE(conf.py.in conf.py)                
-
-# Write the shell file preparing the env for the Sphinx run:
-#    This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
-#    Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
-
-SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-IF(WIN32)
-  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
-  @SET PYTHONPATH=${HDF5_ROOT_DIR}\\lib\;%PYTHONPATH%
-  @SET PYTHONPATH=${MPI_ROOT_DIR}\\lib\;%PYTHONPATH%
-
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\bin\\salome\;%PYTHONPATH%
-  @SET PATH=${KERNEL_ROOT_DIR}\\lib\\salome\;%PATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
-  @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
-
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
-  @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\python\;%PYTHONPATH%
-  @SET PATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PATH%
-  ")
-  SET(EXT "bat")
-  SET(CALL_STR "call")
-ELSE(WIN32)
-  SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-  export PYTHONPATH=${HDF5_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${MPI_ROOT_DIR}/lib:\${PYTHONPATH}
-
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
-  export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
-
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
-  export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
-  export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-  export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
-"
-  )
-  SET(EXT "sh")
-  SET(CALL_STR ".")
-ENDIF(WIN32)
-
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}")
-
-ADD_CUSTOM_TARGET(html_docs_YamsPlug ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${PROJECT_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} docutils
-)
+ADD_CUSTOM_TARGET(html_docs_YamsPlug COMMAND ${_cmd})
 
 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs_YamsPlug)")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils/ DESTINATION ${SALOME_INSTALL_DOC}/gui/SMESH/yams)
+
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES docutils)