]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Update doxygen doc only if an associated source or Doxyfile has been changed
authorRalf Habacker <ralf.habacker@freenet.de>
Fri, 25 Jan 2019 18:05:47 +0000 (19:05 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Wed, 13 Mar 2019 09:49:54 +0000 (10:49 +0100)
Use doxygen.stamp as output for generating doxygen doc similar to
autotools.

doc/CMakeLists.txt

index 528e2531ff96c2b8c7eaf35020067d3085410a2d..6475625f5c5f0edc5485c5068e41064918e7620d 100644 (file)
@@ -3,7 +3,7 @@
 #
 find_package(Doxygen)
 
-# build doc always
+# always check doc target
 add_custom_target(doc ALL)
 
 if(DOXYGEN_EXECUTABLE)
@@ -19,14 +19,17 @@ if(DBUS_ENABLE_DOXYGEN_DOCS)
         set(DBUS_GENERATE_MAN YES)
     endif()
     configure_file(../Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile )
+    file(GLOB dbus_files "${CMAKE_SOURCE_DIR}/dbus/*.[ch]*")
     add_custom_command(
-        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html
+        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
+        DEPENDS ${CMAKE_SOURCE_DIR}/Doxyfile.in  ${CMAKE_BINARY_DIR}/Doxyfile ${dbus_files}
         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+        COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        COMMENT "Generating API documentation with Doxygen"
     )
     add_custom_target(apidoc
-        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
     )
     add_dependencies(doc apidoc)
     install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api/html/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus/api)
@@ -47,7 +50,7 @@ if(DBUS_HAVE_XSLTPROC)
             ${CMAKE_CURRENT_BINARY_DIR}/api/xml/index.xml
         DEPENDS
             ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_to_devhelp.xsl
-            ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html
+            ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
     )
     add_custom_target(devhelp2
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2