]> Creatis software - bbtk.git/blob - kernel/cmake/BBTKBuildDoxygenDoc.cmake
*** empty log message ***
[bbtk.git] / kernel / cmake / BBTKBuildDoxygenDoc.cmake
1
2
3 MACRO(BBTK_BUILD_DOXYGEN_DOC NAME INPUT DOC_RELATIVE_INSTALL_PATH PREDEFINED)
4
5   #--------------------------------------------------------------------------
6   SET(USE_DOXYGEN ON CACHE BOOL "" FORCE)
7   
8   # Name
9   SET(DOXYGEN_PROJECT_NAME "${NAME}")
10
11   # Inputs
12   STRING(REGEX REPLACE ";" " " DOXYGEN_INPUT "${INPUT}")
13
14   # Output dirs
15   SET(DOXYGEN_HTML_OUTPUT ".")
16   SET(DOXYGEN_OUTPUT ${BBTK_DOXYGEN_BUILD_PATH}/${DOC_RELATIVE_INSTALL_PATH})
17   IF(NOT IS_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
18     FILE(MAKE_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
19   ENDIF(NOT IS_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
20
21   # Doc exclude
22   SET(DOXYGEN_EXCLUDE "")
23   STRING(REGEX REPLACE ";" " " DOXYGEN_EXCLUDE "${DOXYGEN_EXCLUDE}")
24
25   # Log file name 
26   SET(DOXYGEN_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/doxygen.log")
27
28   # Predefined symbols
29   STRING(REGEX REPLACE ";" " " DOXYGEN_DOC_PREDEFINED "${PREDEFINED}")
30   
31   #---------------------------------------------------------------------------
32   # DOT verification
33   IF(DOT)
34     GET_FILENAME_COMPONENT(DOXYGEN_DOT_PATH ${DOT} PATH)
35     SET(DOXYGEN_HAVE_DOT "YES")
36   ELSE(DOT)
37     SET(DOXYGEN_DOT_PATH "")
38     SET(DOXYGEN_HAVE_DOT "NO")
39   ENDIF(DOT)
40   
41   #---------------------------------------------------------------------------
42   # Create file and project
43   CONFIGURE_FILE(
44     ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.txt
45     ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.txt
46     IMMEDIATE
47     )
48  
49   
50   ADD_CUSTOM_COMMAND(
51     OUTPUT ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/index.html
52     COMMAND 
53     ${DOXYGEN}
54     ARGS
55     ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.txt
56     #  DEPENDS bbtk bbi 
57     )
58   
59   ADD_CUSTOM_TARGET(doxygen ALL
60     DEPENDS  ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/index.html
61     )
62   
63   INSTALL(
64     DIRECTORY
65     ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}
66     DESTINATION
67     ${BBTK_DOXYGEN_INSTALL_PATH}/${DOC_RELATIVE_INSTALL_PATH}
68     )
69   #--------------------------------------------------------------------------
70
71 ENDMACRO(BBTK_BUILD_DOXYGEN_DOC)