[CMake] CMake and Doxygen documentation

Eric Noulard eric.noulard at gmail.com
Tue Feb 6 03:47:28 EST 2007


2007/2/6, Alan W. Irwin <irwin at beluga.phys.uvic.ca>:
>
> >
> > The problem I see with your scheme is that you force
> > to generate files "in-source", which looks not so good to me
> > (I would go for ${CMAKE_BINARY_DIR}/doc)
> > but you must have your reason.
>
> I too am somewhat concerned this messes up the source tree even when a
> separate build tree is used.  However, I don't know doxygen that well, and
> every time I tried to configure the Doxyfile.* files to work from a separate
> build tree, the result seemed substantially different
[...]

We do out of source doxygen doc generation for our project TSP
you may find the concerned CMakeLists.txt here:
http://cvs.savannah.nongnu.org/viewcvs/tsp/src/doxy/CMakeLists.txt?root=tsp&view=markup

It is not that hard, essentially

1) Write a too-be-configured-by-cmake doxyfile
    Doxyfile.user.in
    using appropriate CMAKE var for giving PATH to source or PATH to
generated doc.

for example:
   OUTPUT_DIRECTORY       = "${CMAKE_BINARY_DIR}/doc/user"

   INPUT                  = "${CMAKE_SOURCE_DIR}/src" \
                                 "${CMAKE_SOURCE_DIR}/include"

2) Add CONFIGURE rule to your CMakeLists.txt
    should be something like:

   CONFIGURE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.user.in
                       ${CMAKE_BINARY_DIR}/Doxyfile.user)

3) Update your ADD_CUSTOM_COMMAND so that you run
    doxygen using the generated file:

   COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile.user

4) You should FILE(COPY or CONFIGURE( some other file if you use
    custom header/footer and image dir with doxygen but it does not seem to
    be the case for you.

And that's it.

> CMake version of libLASi is currently no worse than the old autotools
> version in this respect.

I understand that, I like out-of-source build and we now enforce it for TSP,
nevertheless as you said it isn't "that" essential for your porject.

>
> Thanks again for pointing out how to create a directory with CMake. I was
> looking in the wrong place (cmake -E commands).

I have looked at that too, and it would be nice to have
mkdir and remove_dir for cmake -E command mode since
you still have to "rm -rf " + "mkdir" in your

add_custom_command

which is "unix-only" even if doxygen is fully usable on Windows platform too.

-- 
Erk


More information about the CMake mailing list