56 lines
1.7 KiB
CMake
56 lines
1.7 KiB
CMake
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()
|
|
|
|
function(add_doxygen_target)
|
|
set(options)
|
|
set(oneValueArgs
|
|
TARGET_NAME
|
|
SOURCE_DIR
|
|
DOXY_FILE
|
|
OUTPUT_DIR
|
|
LATEX
|
|
HTML)
|
|
set(multiValueArgs)
|
|
|
|
cmake_parse_arguments(_DOXYGEN
|
|
"${options}"
|
|
"${oneValueArgs}"
|
|
"${multiValueArgs}"
|
|
${ARGN})
|
|
if(DOXYGEN_FOUND)
|
|
set(GENERATE_XML NO)
|
|
set(GENERATE_HTML NO)
|
|
set(GENERATE_LATEX NO)
|
|
set(OUTPUT_DIRECTORY ${_DOXYGEN_OUTPUT_DIR})
|
|
set(SOURCE_DIR ${_DOXYGEN_SOURCE_DIR})
|
|
if(_DOXYGEN_HTML)
|
|
set(GENERATE_HTML YES)
|
|
endif()
|
|
if(_DOXYGEN_LATEX)
|
|
set(GENERATE_LATEX YES)
|
|
endif()
|
|
|
|
set(WORK_DIR ${CMAKE_BINARY_DIR}/_doxygen)
|
|
configure_file(${_DOXYGEN_DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
|
|
|
|
add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
|
|
WORKING_DIRECTORY ${WORK_DIR}
|
|
COMMENT "Generating API documentation with Doxygen")
|
|
else()
|
|
add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM
|
|
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
|
|
endif()
|
|
endfunction()
|