cmlib/CMLibDoxygen.cmake

25 lines
736 B
CMake

option(BUILD_DOXYGEN_DOC "Build documentation with Doxygen" OFF)
set_property(CACHE BUILD_DOXYGEN_DOC PROPERTY STRINGS ON OFF)
function(add_doxygen_target)
if (BUILD_DOXYGEN_DOC)
find_package(Doxygen REQUIRED)
set(options)
set(oneValueArgs TARGET_NAME IN OUT)
set(multiValueArgs)
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
configure_file(${_DOXYGEN_IN} ${_DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
add_custom_target(${_DOXYGEN_TARGET}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
endif()
endfunction()