Update for release 2.3.1
[openjpeg.git] / doc / CMakeLists.txt
1 # Generate target to build the html documentation through CMake tool
2 # After having configured the project with the BUILD_DOC option you can run make doc
3 # to generate the html documentation in the doc/html repository of the build folder.
4
5 # Try to find the doxygen tool
6 find_package(Doxygen)
7
8 if(DOXYGEN_FOUND)
9   # Configure the doxygen config file with variable from CMake and move it
10   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
11     ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
12
13   # Configure the html mainpage file of the doxygen documentation with variable
14   # from CMake and move it
15   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in
16     ${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY)
17   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in
18     ${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY)
19   # copy png file to make local (binary tree) documentation valid:
20   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png
21     ${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY)
22   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png
23     ${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY)
24
25   file(GLOB headers
26     ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h
27     ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c
28     ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h
29     ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c
30   )
31   # Generate new target to build the html documentation
32   add_custom_command(
33     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
34     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
35     DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
36             ${CMAKE_BINARY_DIR}/doc/mainpage.dox
37             ${CMAKE_BINARY_DIR}/doc/openjpip.dox
38             ${headers}
39   )
40   add_custom_target(doc ALL
41     DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
42     COMMENT "Building doxygen documentation"
43   )
44
45   # install HTML documentation (install png files too):
46   install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
47     DESTINATION share/doc
48     PATTERN ".svn" EXCLUDE
49   )
50 else()
51   message(STATUS "Doxygen not found, we cannot generate the documentation")
52 endif()