Search code examples
documentationdoxygendocumentation-generation

Link to external mainpage


I have made a Doxygen documentation, which itself references another documentation using the tag-file mechanism. But inside its mainpage I now would like to link to the mainpage of the external documentation. Of course, I can always specify the file directly:

... uses [OtherDoc](../../../OtherProject/doc/html/index.html) for ...

even more so since the projects are located relative to each other. But nevertheless I would like Doxygen to automate this process, since it needs to know the location of the external documentation, anyway.

So is there a way to somehow symbolically reference the external documentation's mainpage, something along the lines of:

[OtherDoc](\ref OtherProject::mainpage)

or

[OtherDoc](#OtherProject::mainpage)

Solution

  • There is a trick to do this. Say you have projects A and B, then in the main page of project A you could put an @anchor command like so:

    /** @mainpage
     *  @anchor project_a
     */
    

    And in the documentation of project b you can then simply use

     [OtherDoc](\ref project_a)
    

    Note that anchors have to be globally unique, so you need to carefully choose them!