CMakeLists.txt 1009 B

12345678910111213141516171819202122232425
  1. find_package(Doxygen)
  2. IF(NOT DOXYGEN_FOUND)
  3. MESSAGE(STATUS "No Doxygen found. Documentation won't be built")
  4. ELSE()
  5. file(GLOB SOURCES ${CMAKE_CURRENT_LIST_DIR}/../include/*)
  6. file(GLOB MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../doc/*.md)
  7. list(APPEND MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../readme.md)
  8. CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
  9. CONFIGURE_FILE(Doxyfile.zh-cn.in Doxyfile.zh-cn @ONLY)
  10. add_custom_command(OUTPUT html
  11. COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  12. COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.zh-cn
  13. COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html
  14. DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*
  15. WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../
  16. )
  17. add_custom_target(doc ALL DEPENDS html)
  18. install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
  19. DESTINATION ${DOC_INSTALL_DIR}
  20. COMPONENT doc)
  21. ENDIF()