BigBobby
BigBobby

Reputation: 443

doxygen special command to ignore a file

I am adding code to a large library that is documented with Doxygen. I wish for some of the files to not be included in the Doxygen documentation.

The doxyfile contains many controls to include and exclude specific files, but since many people contribute to this library I'd prefer to avoid modifying the doxyfile.

Are there any special commands that I can put into the files themselves, that instructs Doxygen to ignore the whole file?

Upvotes: 12

Views: 14152

Answers (3)

sabbahillel
sabbahillel

Reputation: 4425

How can I make doxygen ignore some code fragment? shows how this can be done. You would put the \cond at the start and \endcond at the end. Also see How to comment out comment in Doxygen documentation

Note that while the file would still be included, the contents of that file would be ignored.

How can I make doxygen ignore some code fragment?

The new and easiest way is to add one comment block with a \cond command at the start and one comment block with a \endcond command at the end of the piece of code that should be ignored. This should be within the same file of course.

But you can also use Doxygen's preprocessor for this: If you put

#ifndef DOXYGEN_SHOULD_SKIP_THIS

 /* code that must be skipped by Doxygen */

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

around the blocks that should be hidden and put:

  PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS

in the config file then all blocks should be skipped by Doxygen as long as ENABLE_PREPROCESSING is set to YES.

Upvotes: 1

Pietro
Pietro

Reputation: 13162

BigBobby: "since many people contribute to this library I'd prefer to avoid modifying the doxyfile."

Consider that you can have multiple doxyfiles in the same project. You could copy the one already available, add what you need, and save it with a different name (e.g. doxyfile_BigBobby).

In particular, I usually put two doxyfiles in the projects, one for the end-user documentation (with just the interfaces), and one for the developers.

Upvotes: 0

gmug
gmug

Reputation: 785

You can't ignore a file by a special command, but you can exclude files from the documentation in the Doxygen configuration file (generally called Doxyfile) by adding the static or relative path to the file which shall be exculded to the EXCLUDE tag, e.g.:

EXCLUDE =  ./../lib/stdio.h

This way you can also exclude whole directories from the documentation:

EXCLUDE =  ./../lib

You can also use the EXCLUDE_PATTERNS tag and use wildcard patterns, e.g.:

EXCLUDE_PATTERNS = */test/*

Hope this helps.

Upvotes: 10

Related Questions