CMakeLists.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. # Try to find the doxygen tool
  5. find_package(Doxygen)
  6. if(DOXYGEN_FOUND)
  7. # Configure the doxygen config file with variable from CMake and move it
  8. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
  9. ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
  10. # Configure the html mainpage file of the doxygen documentation with variable
  11. # from CMake and move it
  12. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in
  13. ${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY)
  14. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in
  15. ${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY)
  16. # copy png file to make local (binary tree) documentation valid:
  17. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png
  18. ${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY)
  19. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png
  20. ${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY)
  21. file(GLOB headers
  22. ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h
  23. ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c
  24. ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h
  25. ${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c
  26. )
  27. # Generate new target to build the html documentation
  28. add_custom_command(
  29. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
  30. COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
  31. DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
  32. ${CMAKE_BINARY_DIR}/doc/mainpage.dox
  33. ${CMAKE_BINARY_DIR}/doc/openjpip.dox
  34. ${headers}
  35. )
  36. add_custom_target(doc ALL
  37. DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
  38. COMMENT "Building doxygen documentation"
  39. )
  40. # install HTML documentation (install png files too):
  41. install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
  42. DESTINATION share/doc
  43. PATTERN ".svn" EXCLUDE
  44. )
  45. else()
  46. message(STATUS "Doxygen not found, we cannot generate the documentation")
  47. endif()