improve doxygen build logic

Doxygen will only be called when the 'doc' target is built
and one of its input files has changed.
This commit is contained in:
Johann Klähn 2013-01-19 22:56:12 +01:00
parent b66c19b1f8
commit 54c14f9770
2 changed files with 24 additions and 10 deletions

View file

@ -1,3 +1,13 @@
# The following will be generated or updated…
# …for every build (target 'doc.auto'):
# • user guide and man pages: if BUILD_DOCS is set
# • HTML versions of the above: if BUILD_DOCS and BUILD_WEB_DOCS are set
#
# …only when the 'doc' target is built explicitly:
# • Doxygen / reference documentation: if USE_DOXYGEN is set
########################################################################
if (USE_DOXYGEN)
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
@ -5,22 +15,23 @@ if (USE_DOXYGEN)
endif()
configure_file(Doxyfile.in Doxyfile @ONLY)
# see INPUT/FILE_PATTERNS in Doxyfile.in
file(GLOB doxygen_input_files ${CMAKE_SOURCE_DIR}/src/*.h)
add_custom_command(OUTPUT html/index.html
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
DEPENDS Doxyfile
DEPENDS Doxyfile ${doxygen_input_files}
COMMENT "Building doxygen documentation")
add_custom_target(doxygen
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
DEPENDS Doxyfile
COMMENT "Building doxygen documentation")
message("NOTE: Doxygen documentation will be built once. Use target doxygen to update.")
list(APPEND ledger_doc_files html/index.html)
endif(USE_DOXYGEN)
add_custom_target(doc.doxygen DEPENDS html/index.html)
else()
add_custom_target(doc.doxygen)
endif()
########################################################################
if(NOT BUILD_DOCS)
add_custom_target(doc ALL DEPENDS ${ledger_doc_files})
add_custom_target(doc DEPENDS doc.doxygen)
return()
endif()
@ -77,7 +88,8 @@ endif(BUILD_WEB_DOCS)
########################################################################
add_custom_target(doc ALL DEPENDS ${ledger_doc_files})
add_custom_target(doc.auto ALL DEPENDS ${ledger_doc_files})
add_custom_target(doc DEPENDS doc.auto doc.doxygen)
########################################################################

View file

@ -679,6 +679,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
# please update dependencies in CMakeList.txt if you change this
INPUT = @PROJECT_SOURCE_DIR@/src
# This tag can be used to specify the character encoding of the source files
@ -697,6 +698,7 @@ INPUT_ENCODING = UTF-8
# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
# *.f90 *.f *.for *.vhd *.vhdl
# please update dependencies in CMakeList.txt if you change this
FILE_PATTERNS = *.h
# The RECURSIVE tag can be used to turn specify whether or not subdirectories