diff --git a/CMLibCommon.cmake b/CMLibCommon.cmake index 79dae59..926c71a 100644 --- a/CMLibCommon.cmake +++ b/CMLibCommon.cmake @@ -39,6 +39,7 @@ include(CMLibSanitizers) include(cotire) include(CMLibFormatSources) +include(CMLibDoxygen) include(CMLibBreathe) include(CMLibQtTranslation) include(CMLibToday) diff --git a/CMLibDoxygen.cmake b/CMLibDoxygen.cmake new file mode 100644 index 0000000..3531048 --- /dev/null +++ b/CMLibDoxygen.cmake @@ -0,0 +1,24 @@ +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() +