[CMake] CMake and Doxygen documentation

Eric Noulard eric.noulard at gmail.com
Mon Feb 5 11:29:50 EST 2007


2007/2/5, Crni Gorac <cgorac at gmail.com>:
> Anyone having a simple example of CMake setup to support target named
> say "docs" in CMake generated makefile so that "make docs" would
> generate project documentation using Doxygen?
>


Here you go the following example add "apidoc" and "apidoc_forced" target.

You may find detailed CMakeLists.txt files:
there
http://cvs.savannah.nongnu.org/viewcvs/tsp/src/doxy/CMakeLists.txt?root=tsp&view=markup
and there
http://cvs.savannah.nongnu.org/viewcvs/tsp/src/CMakeLists.txt?root=tsp&view=markup

They look like

FIND_PACKAGE(Doxygen)

IF (DOXYGEN_FOUND)

SET(DOXYGEN_INPUT <doxyfile>)
SET(DOXYGEN_OUTPUT <pathto_outputfile>

ADD_CUSTOM_COMMAND(
  OUTPUT ${DOXYGEN_OUTPUT}
  COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
  COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
  COMMAND ${CMAKE_COMMAND} -E echo "Done."
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  DEPENDS ${DOXYGEN_INPUT}
  )

ADD_CUSTOM_TARGET(apidoc ALL DEPENDS ${DOXYGEN_OUTPUT})

ADD_CUSTOM_TARGET(apidoc_forced
  COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
  COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
  COMMAND ${CMAKE_COMMAND} -E echo "Done."
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

ENDIF (DOXYGEN_FOUND)


-- 
Erk


More information about the CMake mailing list