1

I often use the project name in comments I write. However, up until now I hardcoded it. Now I realized that if the project name were to change, I would have to go through all the documentation parts and change it. Therefore, I wanted to ask if it is possible to simply reference the project name in the comment and let doxygen fill it out later.

/*! \brief This is the main function of the (project_name) project
*/
int main()
{
    return 0;
}
NOhs
  • 2,780
  • 3
  • 25
  • 59
  • Maybe have a look at ALIASES to define your own command using an environment variable or fixed name to use in the comment. – albert Feb 17 '16 at 10:32
  • I tried this already, but it does not seem to work (see comments below MattOnyx answer) – NOhs Feb 17 '16 at 11:28

1 Answers1

1

I think what you are looking for is environment variables, which you can read about here. The one you are looking for should be $(PROJECT_NAME). To use it, see this answer.

albert
  • 8,285
  • 3
  • 19
  • 32
MattOnyx
  • 172
  • 12
  • If I insert it in a comment block, `$(PROJECT_NAME)` is ignored. – NOhs Feb 17 '16 at 09:08
  • I also tried via an alias: `projectName=$(PROJECT_NAME)`. But this also has no effect. If I try instead: `projectName=test`, the alias command works. So maybe the `PROJECT_NAME` env. var. is not resolved at the correct time? – NOhs Feb 17 '16 at 09:23
  • Did you set `PROJECT_NAME = "MY PROJECT NAME"` your doxygen config file ? – MattOnyx Feb 17 '16 at 09:46
  • Yes. Or more precisely, the doxygen-wizard did for me. Otherwise it would also not show in the generated html I guess, if this was broken. – NOhs Feb 17 '16 at 10:00
  • I would not refer to a very old manual but to the official doxygen site: http://www.doxygen.org where the current manual can be found and the current chapter http://www.stack.nl/~dimitri/doxygen/manual/config.html – albert Feb 17 '16 at 10:29
  • Take a look at [this answer](http://stackoverflow.com/a/14081363/3617473), it could help. – MattOnyx Feb 17 '16 at 13:21
  • Hm. I would prefer a solution where you can use the project name that is already in the doxygen configuration file instead of defining it outside. – NOhs Feb 17 '16 at 14:40