FindDoxygen.cmake 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #.rst:
  2. # FindDoxygen
  3. # -----------
  4. #
  5. # This module looks for Doxygen and the path to Graphviz's dot
  6. #
  7. # Doxygen is a documentation generation tool. Please see
  8. # http://www.doxygen.org
  9. #
  10. # This module accepts the following optional variables:
  11. #
  12. # ::
  13. #
  14. # DOXYGEN_SKIP_DOT = If true this module will skip trying to find Dot
  15. # (an optional component often used by Doxygen)
  16. #
  17. #
  18. #
  19. # This modules defines the following variables:
  20. #
  21. # ::
  22. #
  23. # DOXYGEN_EXECUTABLE = The path to the doxygen command.
  24. # DOXYGEN_FOUND = Was Doxygen found or not?
  25. # DOXYGEN_VERSION = The version reported by doxygen --version
  26. #
  27. #
  28. #
  29. # ::
  30. #
  31. # DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
  32. # DOXYGEN_DOT_FOUND = Was Dot found or not?
  33. #
  34. # For compatibility with older versions of CMake, the now-deprecated
  35. # variable ``DOXYGEN_DOT_PATH`` is set to the path to the directory
  36. # containing ``dot`` as reported in ``DOXYGEN_DOT_EXECUTABLE``.
  37. # The path may have forward slashes even on Windows and is not
  38. # suitable for direct substitution into a ``Doxyfile.in`` template.
  39. # If you need this value, use :command:`get_filename_component`
  40. # to compute it from ``DOXYGEN_DOT_EXECUTABLE`` directly, and
  41. # perhaps the :command:`file(TO_NATIVE_PATH)` command to prepare
  42. # the path for a Doxygen configuration file.
  43. #=============================================================================
  44. # Copyright 2001-2009 Kitware, Inc.
  45. #
  46. # Distributed under the OSI-approved BSD License (the "License");
  47. # see accompanying file Copyright.txt for details.
  48. #
  49. # This software is distributed WITHOUT ANY WARRANTY; without even the
  50. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  51. # See the License for more information.
  52. #=============================================================================
  53. # (To distribute this file outside of CMake, substitute the full
  54. # License text for the above reference.)
  55. # For backwards compatibility support
  56. if(Doxygen_FIND_QUIETLY)
  57. set(DOXYGEN_FIND_QUIETLY TRUE)
  58. endif()
  59. # ===== Rationale for OS X AppBundle mods below =====
  60. # With the OS X GUI version, Doxygen likes to be installed to /Applications and
  61. # it contains the doxygen executable in the bundle. In the versions I've
  62. # seen, it is located in Resources, but in general, more often binaries are
  63. # located in MacOS.
  64. #
  65. # NOTE: The official Doxygen.app that is distributed for OS X uses non-standard
  66. # conventions. Instead of the command-line "doxygen" tool being placed in
  67. # Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and
  68. # "doxygen" is placed in Contents/Resources. This is most likely done
  69. # so that something happens when people double-click on the Doxygen.app
  70. # package. Unfortunately, CMake gets confused by this as when it sees the
  71. # bundle it uses "Doxywizard" as the executable to use instead of
  72. # "doxygen". Therefore to work-around this issue we temporarily disable
  73. # the app-bundle feature, just for this CMake module:
  74. if(APPLE)
  75. # Save the old setting
  76. set(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
  77. # Disable the App-bundle detection feature
  78. set(CMAKE_FIND_APPBUNDLE "NEVER")
  79. endif()
  80. # FYI:
  81. # In the older versions of OS X Doxygen, dot was included with the
  82. # Doxygen bundle. But the new versions require you to download
  83. # Graphviz.app which contains "dot" in it's bundle.
  84. # ============== End OSX stuff ================
  85. #
  86. # Find Doxygen...
  87. #
  88. find_program(DOXYGEN_EXECUTABLE
  89. NAMES doxygen
  90. PATHS
  91. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
  92. /Applications/Doxygen.app/Contents/Resources
  93. /Applications/Doxygen.app/Contents/MacOS
  94. DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
  95. )
  96. if(DOXYGEN_EXECUTABLE)
  97. execute_process(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  98. endif()
  99. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  100. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSION_VAR DOXYGEN_VERSION)
  101. #
  102. # Find Dot...
  103. #
  104. set(_x86 "(x86)")
  105. file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
  106. "$ENV{ProgramFiles}/Graphviz*/bin"
  107. "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
  108. )
  109. unset(_x86)
  110. if(NOT DOXYGEN_SKIP_DOT)
  111. find_program(DOXYGEN_DOT_EXECUTABLE
  112. NAMES dot
  113. PATHS
  114. ${_Doxygen_GRAPHVIZ_BIN_DIRS}
  115. "$ENV{ProgramFiles}/ATT/Graphviz/bin"
  116. "C:/Program Files/ATT/Graphviz/bin"
  117. [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
  118. /Applications/Graphviz.app/Contents/MacOS
  119. /Applications/Doxygen.app/Contents/Resources
  120. /Applications/Doxygen.app/Contents/MacOS
  121. DOC "Graphviz Dot tool for using Doxygen"
  122. )
  123. if(DOXYGEN_DOT_EXECUTABLE)
  124. set(DOXYGEN_DOT_FOUND TRUE)
  125. # The Doxyfile wants the path to Dot, not the entire path and executable
  126. get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH)
  127. endif()
  128. endif()
  129. #
  130. # Backwards compatibility...
  131. #
  132. if(APPLE)
  133. # Restore the old app-bundle setting setting
  134. set(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
  135. endif()
  136. # Maintain the _FOUND variables as "YES" or "NO" for backwards compatibility
  137. # (allows people to stuff them directly into Doxyfile with configure_file())
  138. if(DOXYGEN_FOUND)
  139. set(DOXYGEN_FOUND "YES")
  140. else()
  141. set(DOXYGEN_FOUND "NO")
  142. endif()
  143. if(DOXYGEN_DOT_FOUND)
  144. set(DOXYGEN_DOT_FOUND "YES")
  145. else()
  146. set(DOXYGEN_DOT_FOUND "NO")
  147. endif()
  148. # For backwards compatibility support
  149. set (DOXYGEN ${DOXYGEN_EXECUTABLE} )
  150. set (DOT ${DOXYGEN_DOT_EXECUTABLE} )
  151. mark_as_advanced(
  152. DOXYGEN_EXECUTABLE
  153. DOXYGEN_DOT_EXECUTABLE
  154. )