FindDoxygen.cmake 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindDoxygen
  5. -----------
  6. Doxygen is a documentation generation tool (see http://www.doxygen.org).
  7. This module looks for Doxygen and some optional tools it supports. These
  8. tools are enabled as components in the :command:`find_package` command:
  9. ``dot``
  10. `Graphviz <http://graphviz.org>`_ ``dot`` utility used to render various
  11. graphs.
  12. ``mscgen``
  13. `Message Chart Generator <http://www.mcternan.me.uk/mscgen/>`_ utility used
  14. by Doxygen's ``\msc`` and ``\mscfile`` commands.
  15. ``dia``
  16. `Dia <https://wiki.gnome.org/Apps/Dia>`_ the diagram editor used by Doxygen's
  17. ``\diafile`` command.
  18. Examples:
  19. .. code-block:: cmake
  20. # Require dot, treat the other components as optional
  21. find_package(Doxygen
  22. REQUIRED dot
  23. OPTIONAL_COMPONENTS mscgen dia)
  24. The following variables are defined by this module:
  25. .. variable:: DOXYGEN_FOUND
  26. True if the ``doxygen`` executable was found.
  27. .. variable:: DOXYGEN_VERSION
  28. The version reported by ``doxygen --version``.
  29. The module defines ``IMPORTED`` targets for Doxygen and each component found.
  30. These can be used as part of custom commands, etc. and should be preferred over
  31. old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The
  32. following import targets are defined if their corresponding executable could be
  33. found (the component import targets will only be defined if that component was
  34. requested):
  35. ::
  36. Doxygen::doxygen
  37. Doxygen::dot
  38. Doxygen::mscgen
  39. Doxygen::dia
  40. Functions
  41. ^^^^^^^^^
  42. .. command:: doxygen_add_docs
  43. This function is intended as a convenience for adding a target for generating
  44. documentation with Doxygen. It aims to provide sensible defaults so that
  45. projects can generally just provide the input files and directories and that
  46. will be sufficient to give sensible results. The function supports the
  47. ability to customize the Doxygen configuration used to build the
  48. documentation.
  49. ::
  50. doxygen_add_docs(targetName
  51. [filesOrDirs...]
  52. [ALL]
  53. [WORKING_DIRECTORY dir]
  54. [COMMENT comment])
  55. The function constructs a ``Doxyfile`` and defines a custom target that runs
  56. Doxygen on that generated file. The listed files and directories are used as
  57. the ``INPUT`` of the generated ``Doxyfile`` and they can contain wildcards.
  58. Any files that are listed explicitly will also be added as ``SOURCES`` of the
  59. custom target so they will show up in an IDE project's source list.
  60. So that relative input paths work as expected, by default the working
  61. directory of the Doxygen command will be the current source directory (i.e.
  62. :variable:`CMAKE_CURRENT_SOURCE_DIR`). This can be overridden with the
  63. ``WORKING_DIRECTORY`` option to change the directory used as the relative
  64. base point. Note also that Doxygen's default behavior is to strip the working
  65. directory from relative paths in the generated documentation (see the
  66. ``STRIP_FROM_PATH`` `Doxygen config option
  67. <http://www.doxygen.org/manual/config.html>`_ for details).
  68. If provided, the optional ``comment`` will be passed as the ``COMMENT`` for
  69. the :command:`add_custom_target` command used to create the custom target
  70. internally.
  71. If ALL is set, the target will be added to the default build target.
  72. The contents of the generated ``Doxyfile`` can be customized by setting CMake
  73. variables before calling ``doxygen_add_docs()``. Any variable with a name of
  74. the form ``DOXYGEN_<tag>`` will have its value substituted for the
  75. corresponding ``<tag>`` configuration option in the ``Doxyfile``. See the
  76. `Doxygen documentation <http://www.doxygen.org/manual/config.html>`_ for the
  77. full list of supported configuration options.
  78. Some of Doxygen's defaults are overridden to provide more appropriate
  79. behavior for a CMake project. Each of the following will be explicitly set
  80. unless the variable already has a value before ``doxygen_add_docs()`` is
  81. called (with some exceptions noted):
  82. .. variable:: DOXYGEN_HAVE_DOT
  83. Set to ``YES`` if the ``dot`` component was requested and it was found,
  84. ``NO`` otherwise. Any existing value of ``DOXYGEN_HAVE_DOT`` is ignored.
  85. .. variable:: DOXYGEN_DOT_MULTI_TARGETS
  86. Set to ``YES`` by this module (note that this requires a ``dot`` version
  87. newer than 1.8.10). This option is only meaningful if ``DOXYGEN_HAVE_DOT``
  88. is also set to ``YES``.
  89. .. variable:: DOXYGEN_GENERATE_LATEX
  90. Set to ``NO`` by this module.
  91. .. variable:: DOXYGEN_WARN_FORMAT
  92. For Visual Studio based generators, this is set to the form recognized by
  93. the Visual Studio IDE: ``$file($line) : $text``. For all other generators,
  94. Doxygen's default value is not overridden.
  95. .. variable:: DOXYGEN_PROJECT_NAME
  96. Populated with the name of the current project (i.e.
  97. :variable:`PROJECT_NAME`).
  98. .. variable:: DOXYGEN_PROJECT_NUMBER
  99. Populated with the version of the current project (i.e.
  100. :variable:`PROJECT_VERSION`).
  101. .. variable:: DOXYGEN_PROJECT_BRIEF
  102. Populated with the description of the current project (i.e.
  103. :variable:`PROJECT_DESCRIPTION`).
  104. .. variable:: DOXYGEN_INPUT
  105. Projects should not set this variable. It will be populated with the set of
  106. files and directories passed to ``doxygen_add_docs()``, thereby providing
  107. consistent behavior with the other built-in commands like
  108. :command:`add_executable`, :command:`add_library` and
  109. :command:`add_custom_target`. If a variable named ``DOXYGEN_INPUT`` is set
  110. by the project, it will be ignored and a warning will be issued.
  111. .. variable:: DOXYGEN_RECURSIVE
  112. Set to ``YES`` by this module.
  113. .. variable:: DOXYGEN_EXCLUDE_PATTERNS
  114. If the set of inputs includes directories, this variable will specify
  115. patterns used to exclude files from them. The following patterns are added
  116. by ``doxygen_add_docs()`` to ensure CMake-specific files and directories
  117. are not included in the input. If the project sets
  118. ``DOXYGEN_EXCLUDE_PATTERNS``, those contents are merged with these
  119. additional patterns rather than replacing them:
  120. ::
  121. */.git/*
  122. */.svn/*
  123. */.hg/*
  124. */CMakeFiles/*
  125. */_CPack_Packages/*
  126. DartConfiguration.tcl
  127. CMakeLists.txt
  128. CMakeCache.txt
  129. .. variable:: DOXYGEN_OUTPUT_DIRECTORY
  130. Set to :variable:`CMAKE_CURRENT_BINARY_DIR` by this module. Note that if
  131. the project provides its own value for this and it is a relative path, it
  132. will be converted to an absolute path relative to the current binary
  133. directory. This is necessary because doxygen will normally be run from a
  134. directory within the source tree so that relative source paths work as
  135. expected. If this directory does not exist, it will be recursively created
  136. prior to executing the doxygen commands.
  137. To change any of these defaults or override any other Doxygen config option,
  138. set relevant variables before calling ``doxygen_add_docs()``. For example:
  139. .. code-block:: cmake
  140. set(DOXYGEN_GENERATE_HTML NO)
  141. set(DOXYGEN_GENERATE_MAN YES)
  142. doxygen_add_docs(
  143. doxygen
  144. ${PROJECT_SOURCE_DIR}
  145. COMMENT "Generate man pages"
  146. )
  147. A number of Doxygen config options accept lists of values, but Doxygen requires
  148. them to be separated by whitespace. CMake variables hold lists as a string with
  149. items separated by semi-colons, so a conversion needs to be performed. The
  150. ``doxygen_add_docs()`` command specifically checks the following Doxygen config
  151. options and will convert their associated CMake variable's contents into the
  152. required form if set.
  153. ::
  154. ABBREVIATE_BRIEF
  155. ALIASES
  156. CITE_BIB_FILES
  157. DIAFILE_DIRS
  158. DOTFILE_DIRS
  159. DOT_FONTPATH
  160. ENABLED_SECTIONS
  161. EXAMPLE_PATH
  162. EXAMPLE_PATTERNS
  163. EXCLUDE
  164. EXCLUDE_PATTERNS
  165. EXCLUDE_SYMBOLS
  166. EXPAND_AS_DEFINED
  167. EXTENSION_MAPPING
  168. EXTRA_PACKAGES
  169. EXTRA_SEARCH_MAPPINGS
  170. FILE_PATTERNS
  171. FILTER_PATTERNS
  172. FILTER_SOURCE_PATTERNS
  173. HTML_EXTRA_FILES
  174. HTML_EXTRA_STYLESHEET
  175. IGNORE_PREFIX
  176. IMAGE_PATH
  177. INCLUDE_FILE_PATTERNS
  178. INCLUDE_PATH
  179. INPUT
  180. LATEX_EXTRA_FILES
  181. LATEX_EXTRA_STYLESHEET
  182. MATHJAX_EXTENSIONS
  183. MSCFILE_DIRS
  184. PLANTUML_INCLUDE_PATH
  185. PREDEFINED
  186. QHP_CUST_FILTER_ATTRS
  187. QHP_SECT_FILTER_ATTRS
  188. STRIP_FROM_INC_PATH
  189. STRIP_FROM_PATH
  190. TAGFILES
  191. TCL_SUBST
  192. The following single value Doxygen options will be quoted automatically
  193. if they contain at least one space:
  194. ::
  195. CHM_FILE
  196. DIA_PATH
  197. DOCBOOK_OUTPUT
  198. DOCSET_FEEDNAME
  199. DOCSET_PUBLISHER_NAME
  200. DOT_FONTNAME
  201. DOT_PATH
  202. EXTERNAL_SEARCH_ID
  203. FILE_VERSION_FILTER
  204. GENERATE_TAGFILE
  205. HHC_LOCATION
  206. HTML_FOOTER
  207. HTML_HEADER
  208. HTML_OUTPUT
  209. HTML_STYLESHEET
  210. INPUT_FILTER
  211. LATEX_FOOTER
  212. LATEX_HEADER
  213. LATEX_OUTPUT
  214. LAYOUT_FILE
  215. MAN_OUTPUT
  216. MAN_SUBDIR
  217. MATHJAX_CODEFILE
  218. MSCGEN_PATH
  219. OUTPUT_DIRECTORY
  220. PERL_PATH
  221. PLANTUML_JAR_PATH
  222. PROJECT_BRIEF
  223. PROJECT_LOGO
  224. PROJECT_NAME
  225. QCH_FILE
  226. QHG_LOCATION
  227. QHP_CUST_FILTER_NAME
  228. QHP_VIRTUAL_FOLDER
  229. RTF_EXTENSIONS_FILE
  230. RTF_OUTPUT
  231. RTF_STYLESHEET_FILE
  232. SEARCHDATA_FILE
  233. USE_MDFILE_AS_MAINPAGE
  234. WARN_FORMAT
  235. WARN_LOGFILE
  236. XML_OUTPUT
  237. There are situations where it may be undesirable for a particular config option
  238. to be automatically quoted by ``doxygen_add_docs()``, such as ``ALIASES`` which
  239. may need to include its own embedded quoting. The ``DOXYGEN_VERBATIM_VARS``
  240. variable can be used to specify a list of Doxygen variables (including the
  241. leading ``DOXYGEN_`` prefix) which should not be quoted. The project is then
  242. responsible for ensuring that those variables' values make sense when placed
  243. directly in the Doxygen input file. In the case of list variables, list items
  244. are still separated by spaces, it is only the automatic quoting that is
  245. skipped. For example, the following allows ``doxygen_add_docs()`` to apply
  246. quoting to ``DOXYGEN_PROJECT_BRIEF``, but not each item in the
  247. ``DOXYGEN_ALIASES`` list (:ref:`bracket syntax <Bracket Argument>` can also
  248. be used to make working with embedded quotes easier):
  249. .. code-block:: cmake
  250. set(DOXYGEN_PROJECT_BRIEF "String with spaces")
  251. set(DOXYGEN_ALIASES
  252. [[somealias="@some_command param"]]
  253. "anotherAlias=@foobar"
  254. )
  255. set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES)
  256. The resultant ``Doxyfile`` will contain the following lines:
  257. .. code-block:: text
  258. PROJECT_BRIEF = "String with spaces"
  259. ALIASES = somealias="@some_command param" anotherAlias=@foobar
  260. Deprecated Result Variables
  261. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  262. For compatibility with previous versions of CMake, the following variables
  263. are also defined but they are deprecated and should no longer be used:
  264. .. variable:: DOXYGEN_EXECUTABLE
  265. The path to the ``doxygen`` command. If projects need to refer to the
  266. ``doxygen`` executable directly, they should use the ``Doxygen::doxygen``
  267. import target instead.
  268. .. variable:: DOXYGEN_DOT_FOUND
  269. True if the ``dot`` executable was found.
  270. .. variable:: DOXYGEN_DOT_EXECUTABLE
  271. The path to the ``dot`` command. If projects need to refer to the ``dot``
  272. executable directly, they should use the ``Doxygen::dot`` import target
  273. instead.
  274. .. variable:: DOXYGEN_DOT_PATH
  275. The path to the directory containing the ``dot`` executable as reported in
  276. ``DOXYGEN_DOT_EXECUTABLE``. The path may have forward slashes even on Windows
  277. and is not suitable for direct substitution into a ``Doxyfile.in`` template.
  278. If you need this value, get the :prop_tgt:`IMPORTED_LOCATION` property of the
  279. ``Doxygen::dot`` target and use :command:`get_filename_component` to extract
  280. the directory part of that path. You may also want to consider using
  281. :command:`file(TO_NATIVE_PATH)` to prepare the path for a Doxygen
  282. configuration file.
  283. Deprecated Hint Variables
  284. ^^^^^^^^^^^^^^^^^^^^^^^^^
  285. .. variable:: DOXYGEN_SKIP_DOT
  286. This variable has no effect for the component form of ``find_package``.
  287. In backward compatibility mode (i.e. without components list) it prevents
  288. the finder module from searching for Graphviz's ``dot`` utility.
  289. #]=======================================================================]
  290. cmake_policy(PUSH)
  291. cmake_policy(SET CMP0057 NEW) # if IN_LIST
  292. # For backwards compatibility support
  293. if(Doxygen_FIND_QUIETLY)
  294. set(DOXYGEN_FIND_QUIETLY TRUE)
  295. endif()
  296. # ===== Rationale for OS X AppBundle mods below =====
  297. # With the OS X GUI version, Doxygen likes to be installed to /Applications
  298. # and it contains the doxygen executable in the bundle. In the versions I've
  299. # seen, it is located in Resources, but in general, more often binaries are
  300. # located in MacOS.
  301. #
  302. # NOTE: The official Doxygen.app distributed for OS X uses non-standard
  303. # conventions. Instead of the command-line "doxygen" tool being placed in
  304. # Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and
  305. # "doxygen" is placed in Contents/Resources. This is most likely done
  306. # so that something happens when people double-click on the Doxygen.app
  307. # package. Unfortunately, CMake gets confused by this as when it sees the
  308. # bundle it uses "Doxywizard" as the executable to use instead of
  309. # "doxygen". Therefore to work-around this issue we temporarily disable
  310. # the app-bundle feature, just for this CMake module:
  311. #
  312. if(APPLE)
  313. # Save the old setting
  314. set(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
  315. # Disable the App-bundle detection feature
  316. set(CMAKE_FIND_APPBUNDLE "NEVER")
  317. endif()
  318. # FYI:
  319. # In older versions of OS X Doxygen, dot was included with the Doxygen bundle,
  320. # but newer versions require you to download Graphviz.app which contains "dot"
  321. # or use something like homebrew.
  322. # ============== End OSX stuff ================
  323. #
  324. # Find Doxygen...
  325. #
  326. macro(_Doxygen_find_doxygen)
  327. find_program(
  328. DOXYGEN_EXECUTABLE
  329. NAMES doxygen
  330. PATHS
  331. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
  332. /Applications/Doxygen.app/Contents/Resources
  333. /Applications/Doxygen.app/Contents/MacOS
  334. /Applications/Utilities/Doxygen.app/Contents/Resources
  335. /Applications/Utilities/Doxygen.app/Contents/MacOS
  336. DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
  337. )
  338. mark_as_advanced(DOXYGEN_EXECUTABLE)
  339. if(DOXYGEN_EXECUTABLE)
  340. execute_process(
  341. COMMAND "${DOXYGEN_EXECUTABLE}" --version
  342. OUTPUT_VARIABLE DOXYGEN_VERSION
  343. OUTPUT_STRIP_TRAILING_WHITESPACE
  344. RESULT_VARIABLE _Doxygen_version_result
  345. )
  346. if(_Doxygen_version_result)
  347. message(WARNING "Unable to determine doxygen version: ${_Doxygen_version_result}")
  348. endif()
  349. # Create an imported target for Doxygen
  350. if(NOT TARGET Doxygen::doxygen)
  351. add_executable(Doxygen::doxygen IMPORTED GLOBAL)
  352. set_target_properties(Doxygen::doxygen PROPERTIES
  353. IMPORTED_LOCATION "${DOXYGEN_EXECUTABLE}"
  354. )
  355. endif()
  356. endif()
  357. endmacro()
  358. #
  359. # Find Diagram Editor...
  360. #
  361. macro(_Doxygen_find_dia)
  362. set(_x86 "(x86)")
  363. find_program(
  364. DOXYGEN_DIA_EXECUTABLE
  365. NAMES dia
  366. PATHS
  367. "$ENV{ProgramFiles}/Dia"
  368. "$ENV{ProgramFiles${_x86}}/Dia"
  369. DOC "Diagram Editor tool for use with Doxygen"
  370. )
  371. mark_as_advanced(DOXYGEN_DIA_EXECUTABLE)
  372. if(DOXYGEN_DIA_EXECUTABLE)
  373. # The Doxyfile wants the path to the utility, not the entire path
  374. # including file name
  375. get_filename_component(DOXYGEN_DIA_PATH
  376. "${DOXYGEN_DIA_EXECUTABLE}"
  377. DIRECTORY)
  378. if(WIN32)
  379. file(TO_NATIVE_PATH "${DOXYGEN_DIA_PATH}" DOXYGEN_DIA_PATH)
  380. endif()
  381. # Create an imported target for component
  382. if(NOT TARGET Doxygen::dia)
  383. add_executable(Doxygen::dia IMPORTED GLOBAL)
  384. set_target_properties(Doxygen::dia PROPERTIES
  385. IMPORTED_LOCATION "${DOXYGEN_DIA_EXECUTABLE}"
  386. )
  387. endif()
  388. endif()
  389. unset(_x86)
  390. endmacro()
  391. #
  392. # Find Graphviz Dot...
  393. #
  394. macro(_Doxygen_find_dot)
  395. if(WIN32)
  396. set(_x86 "(x86)")
  397. file(
  398. GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
  399. "$ENV{ProgramFiles}/Graphviz*/bin"
  400. "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
  401. )
  402. unset(_x86)
  403. else()
  404. set(_Doxygen_GRAPHVIZ_BIN_DIRS "")
  405. endif()
  406. find_program(
  407. DOXYGEN_DOT_EXECUTABLE
  408. NAMES dot
  409. PATHS
  410. ${_Doxygen_GRAPHVIZ_BIN_DIRS}
  411. "$ENV{ProgramFiles}/ATT/Graphviz/bin"
  412. "C:/Program Files/ATT/Graphviz/bin"
  413. [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
  414. /Applications/Graphviz.app/Contents/MacOS
  415. /Applications/Utilities/Graphviz.app/Contents/MacOS
  416. /Applications/Doxygen.app/Contents/Resources
  417. /Applications/Doxygen.app/Contents/MacOS
  418. /Applications/Utilities/Doxygen.app/Contents/Resources
  419. /Applications/Utilities/Doxygen.app/Contents/MacOS
  420. DOC "Dot tool for use with Doxygen"
  421. )
  422. mark_as_advanced(DOXYGEN_DOT_EXECUTABLE)
  423. if(DOXYGEN_DOT_EXECUTABLE)
  424. # The Doxyfile wants the path to the utility, not the entire path
  425. # including file name
  426. get_filename_component(DOXYGEN_DOT_PATH
  427. "${DOXYGEN_DOT_EXECUTABLE}"
  428. DIRECTORY)
  429. if(WIN32)
  430. file(TO_NATIVE_PATH "${DOXYGEN_DOT_PATH}" DOXYGEN_DOT_PATH)
  431. endif()
  432. # Create an imported target for component
  433. if(NOT TARGET Doxygen::dot)
  434. add_executable(Doxygen::dot IMPORTED GLOBAL)
  435. set_target_properties(Doxygen::dot PROPERTIES
  436. IMPORTED_LOCATION "${DOXYGEN_DOT_EXECUTABLE}"
  437. )
  438. endif()
  439. endif()
  440. unset(_Doxygen_GRAPHVIZ_BIN_DIRS)
  441. endmacro()
  442. #
  443. # Find Message Sequence Chart...
  444. #
  445. macro(_Doxygen_find_mscgen)
  446. set(_x86 "(x86)")
  447. find_program(
  448. DOXYGEN_MSCGEN_EXECUTABLE
  449. NAMES mscgen
  450. PATHS
  451. "$ENV{ProgramFiles}/Mscgen"
  452. "$ENV{ProgramFiles${_x86}}/Mscgen"
  453. DOC "Message sequence chart tool for use with Doxygen"
  454. )
  455. mark_as_advanced(DOXYGEN_MSCGEN_EXECUTABLE)
  456. if(DOXYGEN_MSCGEN_EXECUTABLE)
  457. # The Doxyfile wants the path to the utility, not the entire path
  458. # including file name
  459. get_filename_component(DOXYGEN_MSCGEN_PATH
  460. "${DOXYGEN_MSCGEN_EXECUTABLE}"
  461. DIRECTORY)
  462. if(WIN32)
  463. file(TO_NATIVE_PATH "${DOXYGEN_MSCGEN_PATH}" DOXYGEN_MSCGEN_PATH)
  464. endif()
  465. # Create an imported target for component
  466. if(NOT TARGET Doxygen::mscgen)
  467. add_executable(Doxygen::mscgen IMPORTED GLOBAL)
  468. set_target_properties(Doxygen::mscgen PROPERTIES
  469. IMPORTED_LOCATION "${DOXYGEN_MSCGEN_EXECUTABLE}"
  470. )
  471. endif()
  472. endif()
  473. unset(_x86)
  474. endmacro()
  475. # Make sure `doxygen` is one of the components to find
  476. set(_Doxygen_keep_backward_compat FALSE)
  477. if(NOT Doxygen_FIND_COMPONENTS)
  478. # Search at least for `doxygen` executable
  479. set(Doxygen_FIND_COMPONENTS doxygen)
  480. # Preserve backward compatibility:
  481. # search for `dot` also if `DOXYGEN_SKIP_DOT` is not explicitly disable this.
  482. if(NOT DOXYGEN_SKIP_DOT)
  483. list(APPEND Doxygen_FIND_COMPONENTS dot)
  484. endif()
  485. set(_Doxygen_keep_backward_compat TRUE)
  486. elseif(NOT doxygen IN_LIST Doxygen_FIND_COMPONENTS)
  487. list(INSERT Doxygen_FIND_COMPONENTS 0 doxygen)
  488. endif()
  489. #
  490. # Find all requested components of Doxygen...
  491. #
  492. foreach(_comp IN LISTS Doxygen_FIND_COMPONENTS)
  493. if(_comp STREQUAL "doxygen")
  494. _Doxygen_find_doxygen()
  495. elseif(_comp STREQUAL "dia")
  496. _Doxygen_find_dia()
  497. elseif(_comp STREQUAL "dot")
  498. _Doxygen_find_dot()
  499. elseif(_comp STREQUAL "mscgen")
  500. _Doxygen_find_mscgen()
  501. else()
  502. message(WARNING "${_comp} is not a valid Doxygen component")
  503. set(Doxygen_${_comp}_FOUND FALSE)
  504. continue()
  505. endif()
  506. if(TARGET Doxygen::${_comp})
  507. set(Doxygen_${_comp}_FOUND TRUE)
  508. else()
  509. set(Doxygen_${_comp}_FOUND FALSE)
  510. endif()
  511. endforeach()
  512. unset(_comp)
  513. # Verify find results
  514. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  515. find_package_handle_standard_args(
  516. Doxygen
  517. REQUIRED_VARS DOXYGEN_EXECUTABLE
  518. VERSION_VAR DOXYGEN_VERSION
  519. HANDLE_COMPONENTS
  520. )
  521. #
  522. # Backwards compatibility...
  523. #
  524. if(APPLE)
  525. # Restore the old app-bundle setting
  526. set(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
  527. endif()
  528. # Maintain the _FOUND variables as "YES" or "NO" for backwards
  529. # compatibility. This allows people to substitute them directly into
  530. # Doxyfile with configure_file().
  531. if(DOXYGEN_FOUND)
  532. set(DOXYGEN_FOUND "YES")
  533. else()
  534. set(DOXYGEN_FOUND "NO")
  535. endif()
  536. if(_Doxygen_keep_backward_compat)
  537. if(Doxygen_dot_FOUND)
  538. set(DOXYGEN_DOT_FOUND "YES")
  539. else()
  540. set(DOXYGEN_DOT_FOUND "NO")
  541. endif()
  542. # For backwards compatibility support for even older CMake versions
  543. set(DOXYGEN ${DOXYGEN_EXECUTABLE})
  544. set(DOT ${DOXYGEN_DOT_EXECUTABLE})
  545. # No need to keep any backward compatibility for `DOXYGEN_MSCGEN_XXX`
  546. # and `DOXYGEN_DIA_XXX` since they were not supported before component
  547. # support was added
  548. endif()
  549. unset(_Doxygen_keep_backward_compat)
  550. #
  551. # Allow full control of Doxygen from CMakeLists.txt
  552. #
  553. # Prepare a template Doxyfile and Doxygen's default values CMake file
  554. if(TARGET Doxygen::doxygen)
  555. # If doxygen was found, use it to generate a minimal default Doxyfile.
  556. # We will delete this file after we have finished using it below to
  557. # generate the other files that doxygen_add_docs() will use.
  558. set(_Doxygen_tpl "${CMAKE_BINARY_DIR}/CMakeDoxyfile.tpl")
  559. execute_process(
  560. COMMAND "${DOXYGEN_EXECUTABLE}" -s -g "${_Doxygen_tpl}"
  561. OUTPUT_QUIET
  562. RESULT_VARIABLE _Doxygen_tpl_result
  563. )
  564. if(_Doxygen_tpl_result)
  565. message(FATAL_ERROR
  566. "Unable to generate Doxyfile template: ${_Doxygen_tpl_result}")
  567. elseif(NOT EXISTS "${_Doxygen_tpl}")
  568. message(FATAL_ERROR
  569. "Doxygen has failed to generate a Doxyfile template")
  570. endif()
  571. # Write a do-not-edit header to files we are going to generate...
  572. set(_Doxygen_dne_header
  573. [[
  574. #
  575. # DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!
  576. #
  577. ]]
  578. )
  579. # We only need one copy of these across the whole build, since their
  580. # content is only dependent on the version of Doxygen being used. Therefore
  581. # we always put them at the top of the build tree so that they are in a
  582. # predictable location.
  583. set(_doxyfile_in "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in")
  584. set(_doxyfile_defaults "${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake")
  585. file(WRITE "${_doxyfile_in}" ${_Doxygen_dne_header})
  586. file(WRITE "${_doxyfile_defaults}" ${_Doxygen_dne_header})
  587. # Get strings containing a configuration key from the template Doxyfile
  588. # we obtained from this version of Doxygen. Because some options are split
  589. # across multiple lines by ending lines with backslashes, we cannot just
  590. # use file(STRINGS...) with a REGEX. Instead, read lines without a REGEX
  591. # so that file(STRINGS...) handles the trailing backslash as a line
  592. # continuation. It stores multi-lines as lists, so we then have to replace
  593. # the ";" list separator with backslashed newlines again so that we get the
  594. # original content stored back as the value part.
  595. file(STRINGS "${_Doxygen_tpl}" _file_lines)
  596. unset(_Doxygen_tpl_params)
  597. foreach(_line IN LISTS _file_lines)
  598. if(_line MATCHES "([A-Z][A-Z0-9_]+)( *=)(.*)")
  599. set(_key "${CMAKE_MATCH_1}")
  600. set(_eql "${CMAKE_MATCH_2}")
  601. set(_value "${CMAKE_MATCH_3}")
  602. string(REPLACE "\\" "\\\\" _value "${_value}")
  603. string(REPLACE ";" "\\\n" _value "${_value}")
  604. list(APPEND _Doxygen_tpl_params "${_key}${_eql}${_value}")
  605. endif()
  606. endforeach()
  607. # Build up a Doxyfile that provides @configVar@ substitutions for each
  608. # Doxygen config option as well as a separate CMake script which provides
  609. # the default value for each of those options if the project doesn't supply
  610. # them. Each config option will support substitution of a CMake variable
  611. # of the same name except with DOXYGEN_ prepended.
  612. foreach(_Doxygen_param IN LISTS _Doxygen_tpl_params)
  613. if(_Doxygen_param MATCHES "([A-Z][A-Z0-9_]+)( *)=( (.*))?")
  614. # Ok, this is a config key with a value
  615. if(CMAKE_MATCH_COUNT EQUAL 4)
  616. file(APPEND "${_doxyfile_in}"
  617. "${CMAKE_MATCH_1}${CMAKE_MATCH_2}= @DOXYGEN_${CMAKE_MATCH_1}@\n")
  618. # Remove the backslashes we had to preserve to handle newlines
  619. string(REPLACE "\\\n" "\n" _value "${CMAKE_MATCH_4}")
  620. file(APPEND "${_doxyfile_defaults}"
  621. "if(NOT DEFINED DOXYGEN_${CMAKE_MATCH_1})
  622. set(DOXYGEN_${CMAKE_MATCH_1} ${_value})
  623. endif()
  624. ")
  625. # Ok, this is a config key with empty default value
  626. elseif(CMAKE_MATCH_COUNT EQUAL 2)
  627. file(APPEND "${_doxyfile_in}"
  628. "${CMAKE_MATCH_1}${CMAKE_MATCH_2}= @DOXYGEN_${CMAKE_MATCH_1}@\n")
  629. else()
  630. message(AUTHOR_WARNING
  631. "Unexpected line format! Code review required!\nFault line: ${_Doxygen_param}")
  632. endif()
  633. else()
  634. message(AUTHOR_WARNING
  635. "Unexpected line format! Code review required!\nFault line: ${_Doxygen_param}")
  636. endif()
  637. endforeach()
  638. # Ok, dumped defaults are not needed anymore...
  639. file(REMOVE "${_Doxygen_tpl}")
  640. unset(_Doxygen_param)
  641. unset(_Doxygen_tpl_params)
  642. unset(_Doxygen_dne_header)
  643. unset(_Doxygen_tpl)
  644. endif()
  645. function(doxygen_quote_value VARIABLE)
  646. # Quote a value of the given variable if:
  647. # - VARIABLE parameter was really given
  648. # - the variable it names is defined and is not present in the list
  649. # specified by DOXYGEN_VERBATIM_VARS (if set)
  650. # - the value of the named variable isn't already quoted
  651. # - the value has spaces
  652. if(VARIABLE AND DEFINED ${VARIABLE} AND
  653. NOT ${VARIABLE} MATCHES "^\".* .*\"$" AND ${VARIABLE} MATCHES " " AND
  654. NOT (DEFINED DOXYGEN_VERBATIM_VARS AND
  655. "${VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS))
  656. set(${VARIABLE} "\"${${VARIABLE}}\"" PARENT_SCOPE)
  657. endif()
  658. endfunction()
  659. function(doxygen_list_to_quoted_strings LIST_VARIABLE)
  660. if(LIST_VARIABLE AND DEFINED ${LIST_VARIABLE})
  661. unset(_inputs)
  662. unset(_sep)
  663. unset(_verbatim)
  664. # Have to test if list items should be treated as verbatim here
  665. # because we lose the variable name when we pass just one list item
  666. # to doxygen_quote_value() below
  667. if(DEFINED DOXYGEN_VERBATIM_VARS AND
  668. "${LIST_VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS)
  669. set(_verbatim True)
  670. endif()
  671. foreach(_in IN LISTS ${LIST_VARIABLE})
  672. if(NOT _verbatim)
  673. doxygen_quote_value(_in)
  674. endif()
  675. string(APPEND _inputs "${_sep}${_in}")
  676. set(_sep " ")
  677. endforeach()
  678. set(${LIST_VARIABLE} "${_inputs}" PARENT_SCOPE)
  679. endif()
  680. endfunction()
  681. function(doxygen_add_docs targetName)
  682. set(_options ALL)
  683. set(_one_value_args WORKING_DIRECTORY COMMENT)
  684. set(_multi_value_args)
  685. cmake_parse_arguments(_args
  686. "${_options}"
  687. "${_one_value_args}"
  688. "${_multi_value_args}"
  689. ${ARGN})
  690. if(NOT _args_COMMENT)
  691. set(_args_COMMENT "Generate API documentation for ${targetName}")
  692. endif()
  693. if(NOT _args_WORKING_DIRECTORY)
  694. set(_args_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
  695. endif()
  696. if(DEFINED DOXYGEN_INPUT)
  697. message(WARNING
  698. "DOXYGEN_INPUT is set but it will be ignored. Pass the files and directories \
  699. directly to the doxygen_add_docs() command instead.")
  700. endif()
  701. set(DOXYGEN_INPUT ${_args_UNPARSED_ARGUMENTS})
  702. if(NOT TARGET Doxygen::doxygen)
  703. message(FATAL_ERROR "Doxygen was not found, needed by \
  704. doxygen_add_docs() for target ${targetName}")
  705. endif()
  706. # If not already defined, set some relevant defaults based on the
  707. # assumption that the documentation is for the whole project. Details
  708. # specified in the project() command will be used to populate a number of
  709. # these defaults.
  710. if(NOT DEFINED DOXYGEN_PROJECT_NAME)
  711. # The PROJECT_NAME tag is a single word (or a sequence of words
  712. # surrounded by double-quotes, unless you are using Doxywizard) that
  713. # should identify the project for which the documentation is generated.
  714. # This name is used in the title of most generated pages and in a few
  715. # other places. The default value is: My Project.
  716. set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
  717. endif()
  718. if(NOT DEFINED DOXYGEN_PROJECT_NUMBER)
  719. # The PROJECT_NUMBER tag can be used to enter a project or revision
  720. # number. This could be handy for archiving the generated documentation
  721. # or if some version control system is used.
  722. set(DOXYGEN_PROJECT_NUMBER ${PROJECT_VERSION})
  723. endif()
  724. if(NOT DEFINED DOXYGEN_PROJECT_BRIEF)
  725. # Using the PROJECT_BRIEF tag one can provide an optional one line
  726. # description for a project that appears at the top of each page and
  727. # should give viewer a quick idea about the purpose of the project.
  728. # Keep the description short.
  729. set(DOXYGEN_PROJECT_BRIEF "${PROJECT_DESCRIPTION}")
  730. endif()
  731. if(NOT DEFINED DOXYGEN_RECURSIVE)
  732. # The RECURSIVE tag can be used to specify whether or not
  733. # subdirectories should be searched for input files as well. CMake
  734. # projects generally evolve to span multiple directories, so it makes
  735. # more sense for this to be on by default. Doxygen's default value
  736. # has this setting turned off, so we override it.
  737. set(DOXYGEN_RECURSIVE YES)
  738. endif()
  739. if(NOT DEFINED DOXYGEN_OUTPUT_DIRECTORY)
  740. # The OUTPUT_DIRECTORY tag is used to specify the (relative or
  741. # absolute) path into which the generated documentation will be
  742. # written. If a relative path is used, Doxygen will interpret it as
  743. # being relative to the location where doxygen was started, but we need
  744. # to run Doxygen in the source tree so that relative input paths work
  745. # intuitively. Therefore, we ensure that the output directory is always
  746. # an absolute path and if the project provided a relative path, we
  747. # treat it as relative to the current BINARY directory so that output
  748. # is not generated inside the source tree.
  749. set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
  750. elseif(NOT IS_ABSOLUTE "${DOXYGEN_OUTPUT_DIRECTORY}")
  751. get_filename_component(DOXYGEN_OUTPUT_DIRECTORY
  752. "${DOXYGEN_OUTPUT_DIRECTORY}"
  753. ABSOLUTE
  754. BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
  755. endif()
  756. if(NOT DEFINED DOXYGEN_HAVE_DOT)
  757. # If you set the HAVE_DOT tag to YES then doxygen will assume the dot
  758. # tool is available from the path. This tool is part of Graphviz (see:
  759. # http://www.graphviz.org/), a graph visualization toolkit from AT&T
  760. # and Lucent Bell Labs. The other options in this section have no
  761. # effect if this option is set to NO.
  762. # Doxygen's default value is: NO.
  763. if(Doxygen_dot_FOUND)
  764. set(DOXYGEN_HAVE_DOT "YES")
  765. else()
  766. set(DOXYGEN_HAVE_DOT "NO")
  767. endif()
  768. endif()
  769. if(NOT DEFINED DOXYGEN_DOT_MULTI_TARGETS)
  770. # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate
  771. # multiple output files in one run (i.e. multiple -o and -T options on
  772. # the command line). This makes dot run faster, but since only newer
  773. # versions of dot (>1.8.10) support this, Doxygen disables this feature
  774. # by default.
  775. # This tag requires that the tag HAVE_DOT is set to YES.
  776. set(DOXYGEN_DOT_MULTI_TARGETS YES)
  777. endif()
  778. if(NOT DEFINED DOXYGEN_GENERATE_LATEX)
  779. # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX
  780. # output. We only want the HTML output enabled by default, so we turn
  781. # this off if the project hasn't specified it.
  782. set(DOXYGEN_GENERATE_LATEX NO)
  783. endif()
  784. if(NOT DEFINED DOXYGEN_WARN_FORMAT)
  785. if(CMAKE_VS_MSBUILD_COMMAND OR CMAKE_VS_DEVENV_COMMAND)
  786. # The WARN_FORMAT tag determines the format of the warning messages
  787. # that doxygen can produce. The string should contain the $file,
  788. # $line and $text tags, which will be replaced by the file and line
  789. # number from which the warning originated and the warning text.
  790. # Optionally, the format may contain $version, which will be
  791. # replaced by the version of the file (if it could be obtained via
  792. # FILE_VERSION_FILTER).
  793. # Doxygen's default value is: $file:$line: $text
  794. set(DOXYGEN_WARN_FORMAT "$file($line) : $text ")
  795. endif()
  796. endif()
  797. if(DEFINED DOXYGEN_WARN_LOGFILE AND NOT IS_ABSOLUTE "${DOXYGEN_WARN_LOGFILE}")
  798. # The WARN_LOGFILE tag can be used to specify a file to which warning and error
  799. # messages should be written. If left blank the output is written to standard
  800. # error (stderr).
  801. get_filename_component(DOXYGEN_WARN_LOGFILE
  802. "${DOXYGEN_WARN_LOGFILE}"
  803. ABSOLUTE
  804. BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
  805. endif()
  806. # Any files from the INPUT that match any of the EXCLUDE_PATTERNS will be
  807. # excluded from the set of input files. We provide some additional patterns
  808. # to prevent commonly unwanted things from CMake builds being pulled in.
  809. #
  810. # Note that the wildcards are matched against the file with absolute path,
  811. # so to exclude all test directories for example use the pattern */test/*
  812. list(
  813. APPEND
  814. DOXYGEN_EXCLUDE_PATTERNS
  815. "*/.git/*"
  816. "*/.svn/*"
  817. "*/.hg/*"
  818. "*/CMakeFiles/*"
  819. "*/_CPack_Packages/*"
  820. "DartConfiguration.tcl"
  821. "CMakeLists.txt"
  822. "CMakeCache.txt"
  823. )
  824. # Now bring in Doxgen's defaults for those things the project has not
  825. # already set and we have not provided above
  826. include("${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake" OPTIONAL)
  827. # Cleanup built HTMLs on "make clean"
  828. # TODO Any other dirs?
  829. if(DOXYGEN_GENERATE_HTML)
  830. if(IS_ABSOLUTE "${DOXYGEN_HTML_OUTPUT}")
  831. set(_args_clean_html_dir "${DOXYGEN_HTML_OUTPUT}")
  832. else()
  833. set(_args_clean_html_dir
  834. "${DOXYGEN_OUTPUT_DIRECTORY}/${DOXYGEN_HTML_OUTPUT}")
  835. endif()
  836. set_property(DIRECTORY APPEND PROPERTY
  837. ADDITIONAL_CLEAN_FILES "${_args_clean_html_dir}")
  838. endif()
  839. # Build up a list of files we can identify from the inputs so we can list
  840. # them as SOURCES in the custom target (makes them display in IDEs). We
  841. # must do this before we transform the various DOXYGEN_... variables below
  842. # because we need to process DOXYGEN_INPUT as a list first.
  843. unset(_sources)
  844. foreach(_item IN LISTS DOXYGEN_INPUT)
  845. get_filename_component(_abs_item "${_item}" ABSOLUTE
  846. BASE_DIR "${_args_WORKING_DIRECTORY}")
  847. if(EXISTS "${_abs_item}" AND
  848. NOT IS_DIRECTORY "${_abs_item}" AND
  849. NOT IS_SYMLINK "${_abs_item}")
  850. list(APPEND _sources "${_abs_item}")
  851. endif()
  852. endforeach()
  853. if(_sources)
  854. list(INSERT _sources 0 SOURCES)
  855. endif()
  856. # Transform known list type options into space separated strings.
  857. set(_doxygen_list_options
  858. ABBREVIATE_BRIEF
  859. ALIASES
  860. CITE_BIB_FILES
  861. DIAFILE_DIRS
  862. DOTFILE_DIRS
  863. DOT_FONTPATH
  864. ENABLED_SECTIONS
  865. EXAMPLE_PATH
  866. EXAMPLE_PATTERNS
  867. EXCLUDE
  868. EXCLUDE_PATTERNS
  869. EXCLUDE_SYMBOLS
  870. EXPAND_AS_DEFINED
  871. EXTENSION_MAPPING
  872. EXTRA_PACKAGES
  873. EXTRA_SEARCH_MAPPINGS
  874. FILE_PATTERNS
  875. FILTER_PATTERNS
  876. FILTER_SOURCE_PATTERNS
  877. HTML_EXTRA_FILES
  878. HTML_EXTRA_STYLESHEET
  879. IGNORE_PREFIX
  880. IMAGE_PATH
  881. INCLUDE_FILE_PATTERNS
  882. INCLUDE_PATH
  883. INPUT
  884. LATEX_EXTRA_FILES
  885. LATEX_EXTRA_STYLESHEET
  886. MATHJAX_EXTENSIONS
  887. MSCFILE_DIRS
  888. PLANTUML_INCLUDE_PATH
  889. PREDEFINED
  890. QHP_CUST_FILTER_ATTRS
  891. QHP_SECT_FILTER_ATTRS
  892. STRIP_FROM_INC_PATH
  893. STRIP_FROM_PATH
  894. TAGFILES
  895. TCL_SUBST
  896. )
  897. foreach(_item IN LISTS _doxygen_list_options)
  898. doxygen_list_to_quoted_strings(DOXYGEN_${_item})
  899. endforeach()
  900. # Transform known single value variables which may contain spaces, such as
  901. # paths or description strings.
  902. set(_doxygen_quoted_options
  903. CHM_FILE
  904. DIA_PATH
  905. DOCBOOK_OUTPUT
  906. DOCSET_FEEDNAME
  907. DOCSET_PUBLISHER_NAME
  908. DOT_FONTNAME
  909. DOT_PATH
  910. EXTERNAL_SEARCH_ID
  911. FILE_VERSION_FILTER
  912. GENERATE_TAGFILE
  913. HHC_LOCATION
  914. HTML_FOOTER
  915. HTML_HEADER
  916. HTML_OUTPUT
  917. HTML_STYLESHEET
  918. INPUT_FILTER
  919. LATEX_FOOTER
  920. LATEX_HEADER
  921. LATEX_OUTPUT
  922. LAYOUT_FILE
  923. MAN_OUTPUT
  924. MAN_SUBDIR
  925. MATHJAX_CODEFILE
  926. MSCGEN_PATH
  927. OUTPUT_DIRECTORY
  928. PERL_PATH
  929. PLANTUML_JAR_PATH
  930. PROJECT_BRIEF
  931. PROJECT_LOGO
  932. PROJECT_NAME
  933. QCH_FILE
  934. QHG_LOCATION
  935. QHP_CUST_FILTER_NAME
  936. QHP_VIRTUAL_FOLDER
  937. RTF_EXTENSIONS_FILE
  938. RTF_OUTPUT
  939. RTF_STYLESHEET_FILE
  940. SEARCHDATA_FILE
  941. USE_MDFILE_AS_MAINPAGE
  942. WARN_FORMAT
  943. WARN_LOGFILE
  944. XML_OUTPUT
  945. )
  946. # Store the unmodified value of DOXYGEN_OUTPUT_DIRECTORY prior to invoking
  947. # doxygen_quote_value() below. This will mutate the string specifically for
  948. # consumption by Doxygen's config file, which we do not want when we use it
  949. # later in the custom target's commands.
  950. set( _original_doxygen_output_dir ${DOXYGEN_OUTPUT_DIRECTORY} )
  951. foreach(_item IN LISTS _doxygen_quoted_options)
  952. doxygen_quote_value(DOXYGEN_${_item})
  953. endforeach()
  954. # Prepare doxygen configuration file
  955. set(_doxyfile_template "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in")
  956. set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}")
  957. configure_file("${_doxyfile_template}" "${_target_doxyfile}")
  958. unset(_all)
  959. if(${_args_ALL})
  960. set(_all ALL)
  961. endif()
  962. # Add the target
  963. add_custom_target( ${targetName} ${_all} VERBATIM
  964. COMMAND ${CMAKE_COMMAND} -E make_directory ${_original_doxygen_output_dir}
  965. COMMAND "${DOXYGEN_EXECUTABLE}" "${_target_doxyfile}"
  966. WORKING_DIRECTORY "${_args_WORKING_DIRECTORY}"
  967. DEPENDS "${_target_doxyfile}"
  968. COMMENT "${_args_COMMENT}"
  969. ${_sources}
  970. )
  971. endfunction()
  972. cmake_policy(POP)