56 lines
1.8 KiB
CMake
56 lines
1.8 KiB
CMake
|
function(myx_cmake_doc_doxygen)
|
||
|
set(DOXYGEN_FOUND AUTO CACHE STRING "Enable Doxygen documentation generator")
|
||
|
set_property(CACHE DOXYGEN_FOUND PROPERTY STRINGS ON OFF AUTO)
|
||
|
|
||
|
find_package(Doxygen)
|
||
|
if(DOXYGEN_FOUND)
|
||
|
set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
||
|
else()
|
||
|
set(DOXYGEN_FOUND OFF CACHE STRING "Doxygen documentation generator disabled" FORCE)
|
||
|
endif()
|
||
|
|
||
|
set(_target "myx-cmake-doc-doxygen-${CMAKE_PROJECT_NAME}")
|
||
|
if(NOT DOXYGEN_FOUND)
|
||
|
message(STATUS "MyxCMake:")
|
||
|
add_custom_target(${_target} VERBATIM COMMENT " Doxygen is not found. Skipping target ${_target} build")
|
||
|
return()
|
||
|
endif()
|
||
|
|
||
|
if(NOT TARGET ${_target})
|
||
|
set(options)
|
||
|
set(oneValueArgs SQLITE LATEX HTML)
|
||
|
set(multiValueArgs)
|
||
|
cmake_parse_arguments(_arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||
|
|
||
|
set(GENERATE_XML YES)
|
||
|
set(GENERATE_HTML NO)
|
||
|
set(GENERATE_LATEX NO)
|
||
|
if(_arg_HTML)
|
||
|
set(GENERATE_HTML YES)
|
||
|
endif()
|
||
|
if(_arg_LATEX)
|
||
|
set(GENERATE_LATEX YES)
|
||
|
endif()
|
||
|
if(_arg_SQLITE)
|
||
|
set(GENERATE_SQLITE YES)
|
||
|
endif()
|
||
|
|
||
|
set(work_dir ${CMAKE_BINARY_DIR}/doc/doxygen)
|
||
|
configure_file(${MYX_CMAKE_FUNCTIONS_DIR}/doc/Doxyfile.in ${work_dir}/Doxyfile @ONLY)
|
||
|
|
||
|
add_custom_target(${_target}
|
||
|
VERBATIM
|
||
|
WORKING_DIRECTORY ${work_dir}
|
||
|
COMMAND "${CMAKE_COMMAND}" -E remove -f "${work_dir}/doxygen_sqlite3.db"
|
||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${work_dir}/Doxyfile
|
||
|
COMMENT "Generating API documentation with Doxygen")
|
||
|
if(_arg_HTML)
|
||
|
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/doxygen/html/
|
||
|
COMPONENT doc OPTIONAL
|
||
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/doxygen)
|
||
|
endif()
|
||
|
else()
|
||
|
message(STATUS "MyxCMake: target ${_target} is already defined.")
|
||
|
endif()
|
||
|
endfunction()
|