FindDoxygen.cmake 4.8 KB

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