FindDoxygen.cmake 38 KB

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