Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / FindDoxygen.cmake
blob2cbe7b4a421680aa0578b82c56ef0e4eb8de56d3
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
5 # This module accepts the following optional variables:
7 #   DOXYGEN_SKIP_DOT       = If true this module will skip trying to find Dot
8 #                            (an optional component often used by Doxygen)
10 # This modules defines the following variables:
12 #   DOXYGEN_EXECUTABLE     = The path to the doxygen command.
13 #   DOXYGEN_FOUND          = Was Doxygen found or not?
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
21 # For backwards compatibility support
22 IF(Doxygen_FIND_QUIETLY)
23   SET(DOXYGEN_FIND_QUIETLY TRUE)
24 ENDIF(Doxygen_FIND_QUIETLY)
26 # ===== Rationale for OS X AppBundle mods below =====
27 #     With the OS X GUI version, Doxygen likes to be installed to /Applications and
28 #     it contains the doxygen executable in the bundle. In the versions I've 
29 #     seen, it is located in Resources, but in general, more often binaries are 
30 #     located in MacOS.
32 #     NOTE: The official Doxygen.app that is distributed for OS X uses non-standard 
33 #     conventions.  Instead of the command-line "doxygen" tool being placed in
34 #     Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and 
35 #     "doxygen" is placed in Contents/Resources.  This is most likely done
36 #     so that something happens when people double-click on the Doxygen.app
37 #     package.  Unfortunately, CMake gets confused by this as when it sees the
38 #     bundle it uses "Doxywizard" as the executable to use instead of
39 #     "doxygen".  Therefore to work-around this issue we temporarily disable
40 #     the app-bundle feature, just for this CMake module:
41 if(APPLE)
42     #  Save the old setting
43     SET(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
44     # Disable the App-bundle detection feature
45     SET(CMAKE_FIND_APPBUNDLE "NEVER")
46 endif()
47 #     FYI:
48 #     In the older versions of OS X Doxygen, dot was included with the 
49 #     Doxygen bundle. But the new versions require you to download
50 #     Graphviz.app which contains "dot" in it's bundle.
51 # ============== End OSX stuff ================
54 # Find Doxygen...
57 FIND_PROGRAM(DOXYGEN_EXECUTABLE
58   NAMES doxygen
59   PATHS
60     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
61     /Applications/Doxygen.app/Contents/Resources
62     /Applications/Doxygen.app/Contents/MacOS
63   DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
66 include(FindPackageHandleStandardArgs)
67 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen DEFAULT_MSG DOXYGEN_EXECUTABLE)
70 # Find Dot...
73 IF(NOT DOXYGEN_SKIP_DOT)
74   FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE
75     NAMES dot
76     PATHS 
77       "$ENV{ProgramFiles}/Graphviz 2.21/bin"
78       "C:/Program Files/Graphviz 2.21/bin"
79       "$ENV{ProgramFiles}/ATT/Graphviz/bin"
80       "C:/Program Files/ATT/Graphviz/bin"
81       [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
82       /Applications/Graphviz.app/Contents/MacOS
83       /Applications/Doxygen.app/Contents/Resources
84       /Applications/Doxygen.app/Contents/MacOS
85     DOC "Graphviz Dot tool for using Doxygen"
86   )
87   
88   if(DOXYGEN_DOT_EXECUTABLE)
89     set(DOXYGEN_DOT_FOUND TRUE)
90     # The Doxyfile wants the path to Dot, not the entire path and executable
91     get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE)
92   endif()
93   
94 endif(NOT DOXYGEN_SKIP_DOT)
97 # Backwards compatibility...
100 if(APPLE)
101   # Restore the old app-bundle setting setting
102   SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
103 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()
118 # For backwards compatibility support
119 SET (DOXYGEN ${DOXYGEN_EXECUTABLE} )
120 SET (DOT ${DOXYGEN_DOT_EXECUTABLE} )
122 MARK_AS_ADVANCED(
123   DOXYGEN_EXECUTABLE
124   DOXYGEN_DOT_EXECUTABLE
125   DOXYGEN_DOT_PATH
126   )