[CMake] custom doxygen target

Yegor Yefremov yegor_sub1 at visionsystems.de
Wed Jul 25 06:35:05 EDT 2007


Stephan Menzel wrote:
> Hello,
>
> I'd like to create a custom doxygen target for a project. The relevant parts 
> look like that:
>
>  /
>   doc/Doxyfile.in
>   lib/[files with all the documentation]
>   build/
>   CMakeLists.txt
>
> Now what I'd like to have is a doxygen target where I can do something like 
> this:
>
>  $ cd build
>  $ cmake ../
>  $ make api-docs
>
> I found some clues on this list and got this far:
>
>         INCLUDE( ${CMAKE_ROOT}/Modules/FindDoxygen.cmake)
>         CONFIGURE_FILE(${MYPROJECT_SOURCE_DIR}/doc/Doxyfile.in
>                 ${MYPROJECT_BINARY_DIR}/api-docs/Doxyfile
>                         @ONLY IMMEDIATE)
>         ADD_CUSTOM_TARGET(api-docs ALL ${DOXYGEN}
>                 \"${MYPROJECT_BINARY_DIR}/api-docs/Doxyfile\" )
>
> I included this into ./CMakeLists.txt and it works well: The only problem is: 
> it is always executed when I do make. "make api-docs" does not work, so I 
> tried it that way:
>
> ADD_CUSTOM_COMMAND(OUTPUT api-docs COMMAND doxygen)
> IF (COMMAND doxygen)
>         INCLUDE( ${CMAKE_ROOT}/Modules/FindDoxygen.cmake)
>         CONFIGURE_FILE(${MYPROJECT_SOURCE_DIR}/doc/Doxyfile.in
>                 ${MYPROJECT_BINARY_DIR}/api-docs/Doxyfile
>                         @ONLY IMMEDIATE)
>         ADD_CUSTOM_TARGET(api-docs ALL ${DOXYGEN}
>                 \"${MYPROJECT_BINARY_DIR}/api-docs/Doxyfile\" )
> ENDIF (COMMAND doxygen)
>
>   
Try something like this:

add_custom_target (api-docs doxygen ${PROJ_SOURCE_DIR}/proj.doxyfile 
WORKING_DIRECTORY ${PROJ_SOURCE_DIR} COMMENT "Generating documentation")
> However, this doesn't work either. So the basic question is: How can I specify 
> a target for "make <target>" and do something in the CMakeLists.txt only when 
> that target is given? I don't want doxygen to run every time. Only when I say 
> so.
>
> I suppose I fail to understand the "command" and "target" mechanism. What 
> would be an appropriate way to do this.
>
> Thanks and Greetings...
>
> Stephan
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

Best regards,
Yegor Yefremov


More information about the CMake mailing list