2019-12-03 16:20:42 +00:00
|
|
|
set(DOXYGEN_FOUND
|
|
|
|
AUTO
|
|
|
|
CACHE STRING "Enable Doxygen documentation generator")
|
|
|
|
set_property(CACHE DOXYGEN_FOUND PROPERTY STRINGS ON OFF AUTO)
|
2019-08-17 08:19:08 +00:00
|
|
|
|
|
|
|
find_package(Doxygen)
|
2019-10-07 10:52:50 +00:00
|
|
|
if(DOXYGEN_FOUND)
|
2019-12-03 16:20:42 +00:00
|
|
|
set(DOXYGEN_FOUND
|
|
|
|
ON
|
|
|
|
CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
2019-08-17 08:19:08 +00:00
|
|
|
else()
|
2019-12-03 16:20:42 +00:00
|
|
|
set(DOXYGEN_FOUND
|
|
|
|
OFF
|
|
|
|
CACHE STRING "Doxygen documentation generator disabled" FORCE)
|
2019-08-17 08:19:08 +00:00
|
|
|
endif()
|
2019-08-17 03:04:04 +00:00
|
|
|
|
2019-08-17 08:19:08 +00:00
|
|
|
function(add_doxygen_target)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(options)
|
2019-12-03 16:20:42 +00:00
|
|
|
set(oneValueArgs TARGET_NAME SQLITE LATEX HTML)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(multiValueArgs)
|
2019-08-17 03:04:04 +00:00
|
|
|
|
2019-12-03 16:23:14 +00:00
|
|
|
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}"
|
|
|
|
${ARGN})
|
2019-10-07 10:52:50 +00:00
|
|
|
if(DOXYGEN_FOUND)
|
2019-10-05 13:31:57 +00:00
|
|
|
set(GENERATE_XML NO)
|
|
|
|
set(GENERATE_HTML NO)
|
|
|
|
set(GENERATE_LATEX NO)
|
2019-12-03 16:20:42 +00:00
|
|
|
set(GENERATE_SQLITE YES)
|
2019-10-07 10:52:50 +00:00
|
|
|
if(_DOXYGEN_HTML)
|
2019-10-05 13:31:57 +00:00
|
|
|
set(GENERATE_HTML YES)
|
|
|
|
endif()
|
2019-10-07 10:52:50 +00:00
|
|
|
if(_DOXYGEN_LATEX)
|
2019-10-05 13:31:57 +00:00
|
|
|
set(GENERATE_LATEX YES)
|
|
|
|
endif()
|
2019-12-03 16:20:42 +00:00
|
|
|
if(_DOXYGEN_SQLITE)
|
|
|
|
set(GENERATE_SQLITE YES)
|
|
|
|
endif()
|
2019-08-17 03:04:04 +00:00
|
|
|
|
2019-12-03 16:20:42 +00:00
|
|
|
set(WORK_DIR ${CMAKE_BINARY_DIR}/doc/doxygen)
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/doc/Doxyfile.in ${WORK_DIR}/Doxyfile @ONLY)
|
2019-08-17 03:04:04 +00:00
|
|
|
|
2019-12-03 16:20:42 +00:00
|
|
|
add_custom_target(
|
2020-03-29 05:44:48 +00:00
|
|
|
${_DOXYGEN_TARGET_NAME}
|
|
|
|
VERBATIM
|
2019-12-03 16:20:42 +00:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove -f "${WORK_DIR}/doxygen_sqlite3.db"
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
|
|
|
|
WORKING_DIRECTORY ${WORK_DIR}
|
|
|
|
COMMENT "Generating API documentation with Doxygen")
|
2019-08-17 08:19:08 +00:00
|
|
|
else()
|
2019-12-03 16:23:14 +00:00
|
|
|
add_custom_target(
|
2020-03-29 05:44:48 +00:00
|
|
|
${_DOXYGEN_TARGET_NAME}
|
|
|
|
VERBATIM
|
2019-12-03 16:23:14 +00:00
|
|
|
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
|
2019-08-17 03:04:04 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|