FindDoxygen.cmake 5.0 KB

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