FindDoxygen.cmake 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # - This module looks for Doxygen and the path to Graphviz's dot
  2. # Doxygen is a documentation generation tool see http://www.doxygen.org
  3. # With the OS X GUI version, it likes to be installed to /Applications and
  4. # it contains the doxygen executable in the bundle. In the versions I've
  5. # seen, it is located in Resources, but in general, more often binaries are
  6. # located in MacOS. This code sets the following variables:
  7. # DOXYGEN_EXECUTABLE = The path to the doxygen command.
  8. # DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
  9. # DOXYGEN_DOT_PATH = The path to dot not including the executable
  10. # DOXYGEN = same as DOXYGEN_EXECUTABLE for backwards compatibility
  11. # DOT = same as DOXYGEN_DOT_EXECUTABLE for backwards compatibility
  12. # The official Doxygen.app that is distributed for OS X uses non-standard
  13. # conventions. Instead of the command-line "doxygen" tool being placed in
  14. # Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and
  15. # "doxygen" is actually placed in Contents/Resources. This is most likely
  16. # to accomodate people who double-click on the Doxygen.app package and expect
  17. # to see something happen. However, the CMake backend gets horribly confused
  18. # by this. Once CMake sees the bundle, it indiscrimately uses Doxywizard
  19. # as the executable to use. The only work-around I have found is to disable
  20. # the app-bundle feature for only this command.
  21. # Save the old setting
  22. SET(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
  23. # Disable the App-bundle detection feature
  24. SET(CMAKE_FIND_APPBUNDLE "NEVER")
  25. # For backwards compatibility support
  26. # DOXYGEN_FIND_QUIETLY, but it should have been
  27. # Doxygen_FIND_QUIETLY.
  28. IF(Doxygen_FIND_QUIETLY)
  29. SET(DOXYGEN_FIND_QUIETLY TRUE)
  30. ENDIF(Doxygen_FIND_QUIETLY)
  31. IF (NOT DOXYGEN_FIND_QUIETLY)
  32. MESSAGE(STATUS "Looking for doxygen...")
  33. ENDIF (NOT DOXYGEN_FIND_QUIETLY)
  34. FIND_PROGRAM(DOXYGEN_EXECUTABLE
  35. NAMES doxygen
  36. PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
  37. /Applications/Doxygen.app/Contents/Resources
  38. /Applications/Doxygen.app/Contents/MacOS
  39. DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
  40. )
  41. IF (DOXYGEN_EXECUTABLE)
  42. SET (DOXYGEN_FOUND "YES")
  43. IF (NOT DOXYGEN_FIND_QUIETLY)
  44. MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN_EXECUTABLE}")
  45. ENDIF (NOT DOXYGEN_FIND_QUIETLY)
  46. ELSE (DOXYGEN_EXECUTABLE)
  47. IF (NOT DOXYGEN_FIND_QUIETLY)
  48. IF (DOXYGEN_FIND_REQUIRED)
  49. MESSAGE(FATAL_ERROR "Looking for doxygen... - NOT found")
  50. ELSE (DOXYGEN_FIND_REQUIRED)
  51. MESSAGE(STATUS "Looking for doxygen... - NOT found")
  52. ENDIF (DOXYGEN_FIND_REQUIRED)
  53. ENDIF (NOT DOXYGEN_FIND_QUIETLY)
  54. ENDIF (DOXYGEN_EXECUTABLE)
  55. # In the older versions of OS X Doxygen, dot was included with the
  56. # Doxygen bundle. But the new versions place make you download Graphviz.app
  57. # which contains dot in its bundle.
  58. IF (NOT DOXYGEN_FIND_QUIETLY)
  59. MESSAGE(STATUS "Looking for dot tool...")
  60. ENDIF (NOT DOXYGEN_FIND_QUIETLY)
  61. FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE
  62. NAMES dot
  63. PATHS "$ENV{ProgramFiles}/ATT/Graphviz/bin"
  64. "C:/Program Files/ATT/Graphviz/bin"
  65. [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
  66. /Applications/Graphviz.app/Contents/MacOS
  67. /Applications/Doxygen.app/Contents/Resources
  68. /Applications/Doxygen.app/Contents/MacOS
  69. DOC "Graphviz Dot tool for using Doxygen"
  70. )
  71. IF (NOT DOXYGEN_FIND_QUIETLY)
  72. IF (DOXYGEN_DOT_EXECUTABLE)
  73. MESSAGE(STATUS "Looking for dot tool... - found ${DOXYGEN_DOT_EXECUTABLE}")
  74. # The Doxyfile wants the path to Dot, not the entire path and executable
  75. GET_FILENAME_COMPONENT(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE)
  76. ELSE (DOXYGEN_DOT_EXECUTABLE)
  77. MESSAGE(STATUS "Looking for dot tool... - NOT found")
  78. ENDIF (DOXYGEN_DOT_EXECUTABLE)
  79. ENDIF (NOT DOXYGEN_FIND_QUIETLY)
  80. # Restore the old app-bundle setting setting
  81. SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
  82. # Backwards compatibility for CMake4.3 and less
  83. SET (DOXYGEN ${DOXYGEN_EXECUTABLE} )
  84. SET (DOT ${DOXYGEN_DOT_EXECUTABLE} )
  85. MARK_AS_ADVANCED(
  86. DOXYGEN_FOUND
  87. DOXYGEN_EXECUTABLE
  88. DOXYGEN_DOT_FOUND
  89. DOXYGEN_DOT_EXECUTABLE
  90. DOXYGEN_DOT_PATH
  91. )