[CMake] Custom build command for documentation

Alexander.Camek at elektrobit.com Alexander.Camek at elektrobit.com
Tue Jan 8 11:20:24 EST 2008



> -----Original Message-----
> From: cmake-bounces+alexander.camek=elektrobit.com at cmake.org 
> [mailto:cmake-bounces+alexander.camek=elektrobit.com at cmake.org
> ] On Behalf Of Stefan Buschmann
> Sent: Tuesday, January 08, 2008 1:51 PM
> To: CMake at cmake.org
> Subject: Re: [CMake] Custom build command for documentation
> 
> Hi,
> 
> You can just define custom dependencies to include all your 
> documentation in one "doc" target.
> 
> E.g. I have a target "Docs" in my project:
>   ADD_CUSTOM_TARGET(Docs)
> 
> And then in each subdirectory that contains a documentation 
> project, I write e.g.:
>   ...
>   ADD_CUSTOM_TARGET(Docs-Doxygen
>     DEPENDS   ${PROJECT_TARGET_CHM}
>   )
>   ...
>   ADD_DEPENDENCIES(Docs
>     Docs-Doxygen
>   )

I have tried this, but I get the error that doc isn't known.
Okay it can't be known, because it is defined in the main CMakeLists.txt and not in the same subdirectory CMakeLists.txt.

> > currently I can generate for some subdirectories my Latex 
> and Doxygen documentation. This is done like it is described 
> in the cmake FAQ.
> > What I now want to do is to collect all this commands of 
> the subdirectory and put it in an unique common build 
> command, e.g. make doc.
> > The idea is that the user can generate all documents with 
> one common command, like cmake currently does during source 
> build when a user types make all.
> >
> > The problem is that when I add a custom target it doesn't 
> know about targets given by a ADD_SUBDIRECTORY command.
> >
> > Consider following structure:
> >
> > \src
> >  \modules
> >   \module1 -> some docu
> >   \module2 -> some docu
> >   \module3 -> some docu
> >  \tools
> >   \tool1 -> some docu
> >   \tool2 -> some docu
> >
> > Then think about the user who types in "make doc" and all 
> documents of the whole build is generated.
> >
> > Is it with current release (cmake 2.4.7) possible to 
> generate such a command for generating documentation?
> >
> > If not so. Does the next big step of cmake (cmake 2.5 or 
> 2.6 ???) consider something like a doc command in it? Similar 
> to the install command which collects all informations of the 
> to installable files. 

What I have currently tried was this:
Consider following structure:

\src (main CMakeLists.txt)
  \modules (module CMakeLists.txt)
   \module1 -> some docu (CMakeLists.txt for module1 with build and all source information stuff, add_library, and so on)
   \module2 -> some docu
   \module3 -> some docu
  \tools
   \tool1 -> some docu
   \tool2 -> some docu

In my CMakeLists.txt at given structure I added after the ADD_SUBDIRECTORY commands in the main CMakeLists.txt

ADD_CUSTOM_TARGET(LaTeX_Documents echo DEPENDS modules_doc tools_doc)
ADD_CUSTOM_TARGET(Doxygen_Documents DEPENDS )
ADD_CUSTOM_TARGET(doc DEPENDS LaTeX_Documents Doxygen_Documents)

Now I added there in the CMakeList.txt after the ADD_SUBDIRECTORY a ADD_CUSTOM_TARGET(modules_doc echo DEPENDS module1_doc module2_doc) and so on.
And for example in my module1 CMakeLists.txt I added ADD_CUSTOM_TARGET(module1_doc echo DEPENDS ${RESULT}) after the whole three step Latex build (as explaned on FAQ).

But that doesn't work, because I get an error: No rule to make target `module1_doc', needed by `modules/CMakeFiles/modules_doc'.

Is it possible do something like that. The idea behind the hierachical step is that every future module developer has only to add his module directory and add his document target to the CMakeLists.txt in the upper directory. Therefore he doesn't need to know or change anything in any other part of the build.

Hope now my idea is more clearer.


Greetings Alexander


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.



More information about the CMake mailing list