]> Creatis software - crea.git/blob - appli/creaNewProject/NewProject/cmake/UserBuildDoxygenDoc.cmake
1d5a0a9a6ae121e60dc5f393c288bbd86d952168
[crea.git] / appli / creaNewProject / NewProject / cmake / UserBuildDoxygenDoc.cmake
1
2
3 MACRO(USER_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 "${${PROJECT_NAME}_DOXYGEN_BUILD_PATH}") 
17   STRING(REGEX REPLACE " " "~" DOXYGEN_OUTPUT "${DOXYGEN_OUTPUT}")
18   
19  
20   IF(NOT IS_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
21     FILE(MAKE_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
22   ENDIF(NOT IS_DIRECTORY ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT})
23
24   # Doc exclude
25   SET(DOXYGEN_EXCLUDE "")
26   STRING(REGEX REPLACE ";" " " DOXYGEN_EXCLUDE "${DOXYGEN_EXCLUDE}")
27
28   # Log file name 
29   SET(DOXYGEN_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/doxygen.log")
30
31   # Predefined symbols
32   STRING(REGEX REPLACE ";" " " DOXYGEN_DOC_PREDEFINED "${PREDEFINED}")
33   
34   #---------------------------------------------------------------------------
35   # DOT verification
36   IF(DOT)
37     GET_FILENAME_COMPONENT(DOXYGEN_DOT_PATH ${DOT} PATH)
38     SET(DOXYGEN_HAVE_DOT "YES")
39   ELSE(DOT)
40     SET(DOXYGEN_DOT_PATH "")
41     SET(DOXYGEN_HAVE_DOT "NO")
42   ENDIF(DOT)
43   
44   #---------------------------------------------------------------------------
45   # Create file and project
46   CONFIGURE_FILE(
47     ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.txt.in
48     ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.txt
49     @ONLY IMMEDIATE
50     )
51  
52   
53   ADD_CUSTOM_COMMAND(
54     OUTPUT ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/index.html
55     COMMAND 
56     ${DOXYGEN}
57     ARGS
58     ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.txt
59     #  DEPENDS bbtk bbi 
60     )
61   
62   ADD_CUSTOM_TARGET(doxygen_${NAME} ALL
63     DEPENDS  ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}/index.html
64     )
65   
66   INSTALL(
67     DIRECTORY
68     ${DOXYGEN_OUTPUT}/${DOXYGEN_HTML_OUTPUT}
69     DESTINATION
70     ${${PROJECT_NAME}_DOXYGEN_INSTALL_PATH}/${DOC_RELATIVE_INSTALL_PATH}
71     )
72   #--------------------------------------------------------------------------
73 #message("user build doxygen , doxygen output = ${DOXYGEN_OUTPUT}")
74 ENDMACRO(USER_BUILD_DOXYGEN_DOC)