medit/doc/CMakeLists.txt
2010-03-21 22:40:47 -07:00

61 lines
3.0 KiB
CMake

FIND_PACKAGE(Perl)
GET_FILENAME_COMPONENT(MOO_HELP_FILES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/help ABSOLUTE)
FILE(MAKE_DIRECTORY ${MOO_HELP_FILES_DIR})
SET(_moo_build_docs)
IF(MOO_DEV_MODE OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/help-sections.h)
SET(_moo_build_docs TRUE)
MESSAGE(STATUS "Will build docs")
ENDIF(MOO_DEV_MODE OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/help-sections.h)
IF(_moo_build_docs)
SET(MOO_HELP_T2T_FILES
license.t2t
prefs-file.t2t
prefs.t2t
user-tools.t2t
regex.t2t
man-medit.t2t
)
GET_FILENAME_COMPONENT(MOO_HELP_T2T_MAIN ${CMAKE_CURRENT_SOURCE_DIR}/medit.t2t ABSOLUTE)
GET_FILENAME_COMPONENT(MOO_HELP_T2T_MAN ${CMAKE_CURRENT_SOURCE_DIR}/man-medit.t2t ABSOLUTE)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/medit.t2t.in ${MOO_HELP_T2T_MAIN} @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/man-medit.t2t.in ${MOO_HELP_T2T_MAN} @ONLY)
GET_FILENAME_COMPONENT(MOO_HELP_HTML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/help.html ABSOLUTE)
GET_FILENAME_COMPONENT(MOO_MAKEDOCS_CMAKE ${CMAKE_CURRENT_SOURCE_DIR}/makedocs.cmake ABSOLUTE)
GET_FILENAME_COMPONENT(MOO_HELP_MAN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/medit.1 ABSOLUTE)
GET_FILENAME_COMPONENT(MOO_HELP_SECTIONS_H ${CMAKE_CURRENT_SOURCE_DIR}/help-sections.h ABSOLUTE)
GET_FILENAME_COMPONENT(MOO_HELP_TXT2TAGS_PY ${CMAKE_CURRENT_SOURCE_DIR}/txt2tags/txt2tags.py ABSOLUTE)
ADD_CUSTOM_COMMAND(OUTPUT ${MOO_HELP_HTML_FILE}
COMMAND ${CMAKE_COMMAND} -D INPUT_FILE=${MOO_HELP_T2T_MAIN}
-D OUTPUT_FILE=${MOO_HELP_HTML_FILE}
-D OUTPUT_DIR=${MOO_HELP_FILES_DIR}
-D SECTIONS_FILE=${MOO_HELP_SECTIONS_H}
-D MAN_INPUT_FILE=${MOO_HELP_T2T_MAN}
-D MAN_OUTPUT_FILE=${MOO_HELP_MAN_FILE}
-D PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-D PERL_EXECUTABLE=${PERL_EXECUTABLE}
-D TXT2TAGS=${MOO_HELP_TXT2TAGS_PY}
-P ${MOO_MAKEDOCS_CMAKE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
MAIN_DEPENDENCY ${MOO_HELP_T2T_MAIN}
DEPENDS ${MOO_MAKEDOCS_CMAKE} ${MOO_HELP_T2T_FILES})
SET_SOURCE_FILES_PROPERTIES(${MOO_HELP_MAN_FILE} PROPERTIES EXTERNAL_OBJECT 1 GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${MOO_HELP_SECTIONS_H} ${MOO_HELP_T2T_MAIN} ${MOO_HELP_T2T_MAN} PROPERTIES GENERATED 1)
ADD_CUSTOM_TARGET(doc ALL DEPENDS ${MOO_HELP_HTML_FILE})
ENDIF(_moo_build_docs)
INSTALL(DIRECTORY ${MOO_HELP_FILES_DIR}/ DESTINATION ${MOO_HELP_DIR})
IF(UNIX)
INSTALL(FILES medit.1 DESTINATION ${MANDIR}/man1)
ENDIF(UNIX)
# ADD_CUSTOM_TARGET(doc-clean COMMAND ${CMAKE_COMMAND} -E remove ${MOO_DOC_MEDIT_TXT} ${MOO_DOC_HTML_FILE} ${MOO_HELP_SECTIONS_H} ${MOO_DOC_STAMP_FILE})