Commit 894a8618 authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

COMP: Mark DOXYGEN_EXECUTABLE as unadvanced before it is found.

Make FindDoxygen REQUIRED when building documentation.
parent 088bda67
# - Run Doxygen # - Run Doxygen
# #
# Adds a doxygen target that runs doxygen to generate the html # Adds a doxygen target that runs doxygen to generate the html and
# and optionally the LaTeX API documentation. # optionally the LaTeX API documentation. The doxygen target is added
# The doxygen target is added to the doc target as dependency. # to the doc target as dependency. i.e.: the API documentation is
# i.e.: the API documentation is built with: # built with: make doc
# make doc #
#
# USAGE: GLOBAL INSTALL # USAGE: GLOBAL INSTALL
# #
# Install it with: # Install it with: cmake ./ && sudo make install Add the following to
# cmake ./ && sudo make install # the CMakeLists.txt of your project: include(UseDoxygen OPTIONAL)
# Add the following to the CMakeLists.txt of your project: # Optionally copy Doxyfile.in in the directory of CMakeLists.txt and
# include(UseDoxygen OPTIONAL) # edit it.
# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it. #
#
# USAGE: INCLUDE IN PROJECT # USAGE: INCLUDE IN PROJECT
# #
# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) # set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# include(UseDoxygen) # include(UseDoxygen) Add the Doxyfile.in and UseDoxygen.cmake files
# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory. # to the projects source directory.
# #
# #
# Variables you may define are: # Variables you may define are: DOXYFILE_OUTPUT_DIR - Path where the
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc". # Doxygen output is stored. Defaults to "doc".
# #
# DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is stored. Defaults to "latex". # DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is
# # stored. Defaults to "latex".
# DOXYFILE_HTML_DIR - Directory where the Doxygen html output is stored. Defaults to "html". #
# # DOXYFILE_HTML_DIR - Directory where the Doxygen html output is
# stored. Defaults to "html".
# #
# Copyright (c) 2009, 2010 Tobias Rautenkranz <tobias@rautenkranz.ch> # Copyright (c) 2009, 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
...@@ -38,63 +37,65 @@ ...@@ -38,63 +37,65 @@
# #
macro(usedoxygen_set_default name value) macro(usedoxygen_set_default name value)
if(NOT DEFINED "${name}") if(NOT DEFINED "${name}")
set("${name}" "${value}") set("${name}" "${value}")
endif() endif()
endmacro() endmacro()
find_package(Doxygen) mark_as_advanced(CLEAR DOXYGEN_EXECUTABLE)
find_package(Doxygen REQUIRED)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
find_file(DOXYFILE_IN "Doxyfile.in" mark_as_advanced(FORCE DOXYGEN_EXECUTABLE)
PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/" find_file(DOXYFILE_IN "Doxyfile.in"
NO_DEFAULT_PATH) PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
include(FindPackageHandleStandardArgs) NO_DEFAULT_PATH)
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN") include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
endif() endif()
if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND) if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/doc")
usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/doc") set_property(DIRECTORY APPEND PROPERTY
usedoxygen_set_default(DOXYFILE_HTML_DIR "html") ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
set_property(DIRECTORY APPEND PROPERTY set(DOXYFILE_LATEX "NO")
ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}") set(DOXYFILE_PDFLATEX "NO")
set(DOXYFILE_DOT "NO")
set(DOXYFILE_LATEX "NO") find_package(LATEX)
set(DOXYFILE_PDFLATEX "NO") if(LATEX_COMPILER AND MAKEINDEX_COMPILER)
set(DOXYFILE_DOT "NO") set(DOXYFILE_LATEX "YES")
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
find_package(LATEX) set_property(DIRECTORY APPEND PROPERTY
if(LATEX_COMPILER AND MAKEINDEX_COMPILER) ADDITIONAL_MAKE_CLEAN_FILES
set(DOXYFILE_LATEX "YES") "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
set_property(DIRECTORY APPEND PROPERTY if(PDFLATEX_COMPILER)
ADDITIONAL_MAKE_CLEAN_FILES set(DOXYFILE_PDFLATEX "YES")
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}") endif()
if(DOXYGEN_DOT_EXECUTABLE)
set(DOXYFILE_DOT "YES")
endif()
if(PDFLATEX_COMPILER) add_custom_command(TARGET doxygen
set(DOXYFILE_PDFLATEX "YES") POST_BUILD
endif() COMMAND ${CMAKE_MAKE_PROGRAM}
if(DOXYGEN_DOT_EXECUTABLE) WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
set(DOXYFILE_DOT "YES") endif()
endif()
add_custom_command(TARGET doxygen
POST_BUILD
COMMAND ${CMAKE_MAKE_PROGRAM}
WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
endif()
configure_file(${DOXYFILE_IN} Doxyfile ESCAPE_QUOTES IMMEDIATE @ONLY)
configure_file(${DOXYFILE_IN} Doxyfile ESCAPE_QUOTES IMMEDIATE @ONLY) get_target_property(DOC_TARGET doc TYPE)
if(NOT DOC_TARGET)
add_custom_target(doc)
endif()
get_target_property(DOC_TARGET doc TYPE) add_dependencies(doc doxygen)
if(NOT DOC_TARGET)
add_custom_target(doc)
endif()
add_dependencies(doc doxygen)
endif() endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment