Doxygen and License/Copyright informations

Building on Chris' answer, you can use the \par command to create a block similar to the built in \copyright command. For example, an alias like:

ALIASES += "license=@par License:\n"

Will allow this comment:

/** My main function.

    \copyright Copyright 2012 Chris Enterprises. All rights reserved.
    \license This project is released under the GNU Public License.
*/
int main(void){
    return 0;
}

to produce this output:

enter image description here

Note that with this solution, a blank line is not required before \license, and that the {} syntax is not required. This is also less likely to cause problems if you attempt to generate documentation for formats other than HTML.


Whilst I agree with your distinction between copyright and license information, it seems that doxygen doesn't offer separate commands for these. In fact, from the documentation of the \author command the command \copyright is used to indicate license information.

There are (at least) two possible things you can do here:

  1. Simply combine the copyright and license information into the argument of the \copyright command:

    /** My main function.
    
        \copyright Copyright 2012 Chris Enterprises. All rights reserved.
        This project is released under the GNU Public License.
    */
    int main(void){
        return 0;
    }
    

    This generates the HTML

    Screenshot of the documentation generated by doxygen using first solution

    This is almost certainly the easiest thing you can do.

  2. Alternatively, the HTML which is written to produce the above image is

    <dl class="section copyright"><dt>Copyright</dt><dd>Copyright 2012 Chris Enterprises. All rights reserved. This project is released under the GNU Public License. </dd></dl>
    

    We can make use of this to define a new command called, say, license, which behaves in a similar way to the copyright command. Placing the following into the ALIASES field of the doxygen configuration file

    ALIASES += license{1}="<dl class=\"section copyright\"><dt>License</dt><dd>\1 </dd></dl>"
    

    and changing the above documentation block to

    /** My main function.
    
        \copyright Copyright 2012 Chris Enterprises. All rights reserved.
    
        \license{This project is released under the GNU Public License.}
    */
    

    we get the doxygen generated output

    Screenshot of the documentation generated by doxygen using second solution

    Note that there are a couple of quirks in this second solution: there must be a blank line preceding the \license{...} command and the \license command must wrap it's argument in curly braces. You can optionally do this with the \copyright command, but the commands with arguments defined via ALIASES these must have braces.