2020-01-10 17:58:41 +01:00
|
|
|
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
|
|
|
|
2019-02-06 17:30:52 +01:00
|
|
|
if (NOT BASIC_PROJECT_CONFIG_DONE)
|
2017-02-11 02:30:46 +01:00
|
|
|
message(FATAL_ERROR "Before including the Doxygen module, the BasicConfig module must be included.")
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
2017-02-11 02:30:46 +01:00
|
|
|
|
2016-09-29 20:28:02 +02:00
|
|
|
option(NO_DOXYGEN "whether creation of Doxygen targets is disabled (enabled by default)" OFF)
|
2019-02-06 17:30:52 +01:00
|
|
|
if (NO_DOXYGEN)
|
2018-02-21 23:00:32 +01:00
|
|
|
return()
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# find doxygen.h template
|
|
|
|
include(TemplateFinder)
|
|
|
|
find_template_file("doxygen" CPP_UTILITIES DOXYGEN_TEMPLATE_FILE)
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# find executables
|
|
|
|
find_program(DOXYGEN_BIN doxygen)
|
|
|
|
find_program(PERL_BIN perl)
|
|
|
|
find_program(DIA_BIN dia)
|
2019-02-06 17:30:52 +01:00
|
|
|
if (DIA_BIN)
|
2018-02-21 23:00:32 +01:00
|
|
|
set(HAVE_DIA "YES")
|
2019-02-06 17:30:52 +01:00
|
|
|
else ()
|
2018-02-21 23:00:32 +01:00
|
|
|
set(HAVE_DIA "NO")
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
2018-02-21 23:00:32 +01:00
|
|
|
find_program(DOT_BIN dot)
|
2019-02-06 17:30:52 +01:00
|
|
|
if (DOT_BIN)
|
2018-02-21 23:00:32 +01:00
|
|
|
set(HAVE_DOT "YES")
|
2019-02-06 17:30:52 +01:00
|
|
|
else ()
|
2018-02-21 23:00:32 +01:00
|
|
|
set(HAVE_DOT "NO")
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
|
|
|
if (NOT DOXYGEN_BIN)
|
2019-05-04 20:57:56 +02:00
|
|
|
message(WARNING "Doxygen not found, unable to add target for generating API documentation for ${META_TARGET_NAME}")
|
2018-02-21 23:00:32 +01:00
|
|
|
return()
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# load cached configuration and other variables
|
2019-11-30 17:58:01 +01:00
|
|
|
set(DOXY_LANGUAGE
|
|
|
|
"English"
|
|
|
|
CACHE STRING "specifies the language of the API documentation generated with Doxygen")
|
|
|
|
set(DOXY_CUSTOM_CONFIG
|
|
|
|
""
|
|
|
|
CACHE STRING "specifies extra options for Doxygen")
|
2018-02-21 23:00:32 +01:00
|
|
|
set(DOXY_NUMBER "${META_APP_VERSION}")
|
|
|
|
set(DOXY_INPUT_FILES
|
2019-02-06 17:30:52 +01:00
|
|
|
${HEADER_FILES}
|
|
|
|
${SRC_FILES}
|
|
|
|
${TEST_HEADER_FILES}
|
|
|
|
${TEST_SRC_FILES}
|
|
|
|
${WIDGETS_HEADER_FILES}
|
|
|
|
${WIDGETS_SRC_FILES}
|
|
|
|
${QML_HEADER_FILES}
|
|
|
|
${QML_SRC_FILES}
|
2019-07-13 13:56:15 +02:00
|
|
|
${EXCLUDED_FILES}
|
|
|
|
${DOC_FILES})
|
2018-02-21 23:00:32 +01:00
|
|
|
set(DOXY_PATH_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/")
|
|
|
|
list(GET DOC_FILES 0 DOXY_MAIN_PAGE_FILE)
|
|
|
|
set(DOXY_MAIN_PAGE_FILE "${DOXY_PATH_PREFIX}${DOXY_MAIN_PAGE_FILE}")
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# convert DOXY_INPUT_FILES to whitespace-separated list
|
|
|
|
include(ListToString)
|
2019-11-30 17:58:01 +01:00
|
|
|
list_to_string(" " "\"${DOXY_PATH_PREFIX}" "\"" "${DOXY_INPUT_FILES}" DOXY_INPUT_FILES_WHITESPACE_SEPARATED)
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# generate Doxygen configuration
|
2019-02-06 17:30:52 +01:00
|
|
|
configure_file("${DOXYGEN_TEMPLATE_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.config")
|
2016-06-10 22:59:22 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# add target for generating API documentation
|
2019-05-04 20:57:56 +02:00
|
|
|
add_custom_target("${META_TARGET_NAME}_apidoc" COMMAND "${DOXYGEN_BIN}" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.config")
|
2019-02-06 17:30:52 +01:00
|
|
|
if (NOT TARGET apidoc)
|
2018-02-21 23:00:32 +01:00
|
|
|
add_custom_target(apidoc)
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
2019-04-22 22:19:08 +02:00
|
|
|
add_dependencies(apidoc "${META_TARGET_NAME}_apidoc")
|
2016-09-29 20:28:02 +02:00
|
|
|
|
2018-02-21 23:00:32 +01:00
|
|
|
# add install target for API documentation
|
2019-02-06 17:30:52 +01:00
|
|
|
if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
2019-11-30 17:58:01 +01:00
|
|
|
install(
|
|
|
|
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/api-doc"
|
|
|
|
DESTINATION "${META_DATA_DIR}"
|
|
|
|
COMPONENT api-doc
|
|
|
|
OPTIONAL)
|
2019-02-06 17:30:52 +01:00
|
|
|
if (NOT TARGET install-api-doc)
|
2019-11-30 17:58:01 +01:00
|
|
|
add_custom_target(install-api-doc COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=api-doc -P
|
|
|
|
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
2019-02-06 17:30:52 +01:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2018-02-21 23:00:32 +01:00
|
|
|
|
2019-05-04 20:57:56 +02:00
|
|
|
message(STATUS "Generating target for generating API documentation for ${META_TARGET_NAME} with Doxygen")
|