13

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?

3 Answers 3

13

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.

Sign up to request clarification or add additional context in comments.

2 Comments

How would you go about and exclude multiple folders with totally different relative paths?
@Avamander see for example stackoverflow.com/a/28831683/80901
1

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.

8 Comments

Thanks, but I do wish to make the whole file excluded from the Files list in the Doxygen documentation. I use the /cond commands to ignore parts of files already, but there are some whole files that I wish to be excluded. I can do this easily in the doxyfile, but the other contributors to the library would prefer for me to not modify the doxyfile.
@BigBobby Yes that is why I suggested just excluding everything in the file using the /cond. At least that way Doxygen would exit without putting anything in to the system. If you made the /cond and /endcon the first and last lines in the file, what would happen? I do not have access to Doxygen now so I can only answer theoretically.
When I made the /cond and /endcon the first and last lines in the file, it still showed up in the Files list but the page for that file is blank.
@BigBobby OK thanks. Google did show certain methods but most of them involved .text or .doxy files. Otherwise it mentioned the EXCLUDE specification which you sted you cannot add to the doxyfile. Does the doxyfile have an INCLUDE specification or is it set to globally include everything?
After I proved it was impossible with tags in the code, I was allowed to change the doxyfile.
|
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.