FindDoxygen.cmake 41 KB

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