2020-04-11 07:12:20 +00:00
|
|
|
set(DOXYGEN_FOUND AUTO CACHE STRING "Enable Doxygen documentation generator")
|
2019-12-03 16:20:42 +00:00
|
|
|
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)
|
2020-04-11 07:12:20 +00:00
|
|
|
set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
2019-08-17 08:19:08 +00:00
|
|
|
else()
|
2020-04-11 07:12:20 +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
|
|
|
|
2020-04-13 16:44:42 +00:00
|
|
|
function(add_doxygen target)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(options)
|
2020-04-13 16:44:42 +00:00
|
|
|
set(oneValueArgs SQLITE LATEX HTML)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(multiValueArgs)
|
2019-08-17 03:04:04 +00:00
|
|
|
|
2020-04-01 18:42:59 +00:00
|
|
|
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
2019-10-07 10:52:50 +00:00
|
|
|
if(DOXYGEN_FOUND)
|
2020-04-13 16:44:42 +00:00
|
|
|
set(GENERATE_XML YES)
|
2019-10-05 13:31:57 +00:00
|
|
|
set(GENERATE_HTML NO)
|
|
|
|
set(GENERATE_LATEX NO)
|
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-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-04-13 16:44:42 +00:00
|
|
|
${target}
|
2020-03-29 05:44:48 +00:00
|
|
|
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()
|
2020-04-13 16:44:42 +00:00
|
|
|
message(STATUS "CMLIB warning:")
|
2020-04-14 09:20:01 +00:00
|
|
|
add_custom_target(${target} VERBATIM COMMENT " Doxygen is not found. Skipping target ${target} build")
|
2019-08-17 03:04:04 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|