FindDoxygen.cmake 5.67 KB
Newer Older
1 2 3 4 5 6
#.rst:
# FindDoxygen
# -----------
#
# This module looks for Doxygen and the path to Graphviz's dot
#
7 8
# Doxygen is a documentation generation tool.  Please see
# http://www.doxygen.org
9 10 11
#
# This module accepts the following optional variables:
#
12 13 14 15 16 17
# ::
#
#    DOXYGEN_SKIP_DOT       = If true this module will skip trying to find Dot
#                             (an optional component often used by Doxygen)
#
#
18 19 20
#
# This modules defines the following variables:
#
21 22 23 24 25 26
# ::
#
#    DOXYGEN_EXECUTABLE     = The path to the doxygen command.
#    DOXYGEN_FOUND          = Was Doxygen found or not?
#    DOXYGEN_VERSION        = The version reported by doxygen --version
#
27 28
#
#
29
# ::
30
#
31 32
#    DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
#    DOXYGEN_DOT_FOUND      = Was Dot found or not?
33 34 35 36 37 38 39 40 41 42
#
# For compatibility with older versions of CMake, the now-deprecated
# variable ``DOXYGEN_DOT_PATH`` is set to the path to the directory
# containing ``dot`` as reported in ``DOXYGEN_DOT_EXECUTABLE``.
# The path may have forward slashes even on Windows and is not
# suitable for direct substitution into a ``Doxyfile.in`` template.
# If you need this value, use :command:`get_filename_component`
# to compute it from ``DOXYGEN_DOT_EXECUTABLE`` directly, and
# perhaps the :command:`file(TO_NATIVE_PATH)` command to prepare
# the path for a Doxygen configuration file.
43

44 45 46 47 48 49 50 51 52 53
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
54
# (To distribute this file outside of CMake, substitute the full
55 56
#  License text for the above reference.)

57
# For backwards compatibility support
58 59
if(Doxygen_FIND_QUIETLY)
  set(DOXYGEN_FIND_QUIETLY TRUE)
60
endif()
61 62 63

# ===== Rationale for OS X AppBundle mods below =====
#     With the OS X GUI version, Doxygen likes to be installed to /Applications and
64 65
#     it contains the doxygen executable in the bundle. In the versions I've
#     seen, it is located in Resources, but in general, more often binaries are
66 67
#     located in MacOS.
#
68
#     NOTE: The official Doxygen.app that is distributed for OS X uses non-standard
69
#     conventions.  Instead of the command-line "doxygen" tool being placed in
70
#     Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and
71 72 73 74 75 76
#     "doxygen" is placed in Contents/Resources.  This is most likely done
#     so that something happens when people double-click on the Doxygen.app
#     package.  Unfortunately, CMake gets confused by this as when it sees the
#     bundle it uses "Doxywizard" as the executable to use instead of
#     "doxygen".  Therefore to work-around this issue we temporarily disable
#     the app-bundle feature, just for this CMake module:
77 78
if(APPLE)
    #  Save the old setting
79
    set(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
80
    # Disable the App-bundle detection feature
81
    set(CMAKE_FIND_APPBUNDLE "NEVER")
82 83
endif()
#     FYI:
84
#     In the older versions of OS X Doxygen, dot was included with the
85 86
#     Doxygen bundle. But the new versions require you to download
#     Graphviz.app which contains "dot" in it's bundle.
87 88 89 90 91
# ============== End OSX stuff ================

#
# Find Doxygen...
#
92

93
find_program(DOXYGEN_EXECUTABLE
94
  NAMES doxygen
95 96 97 98
  PATHS
    "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
    /Applications/Doxygen.app/Contents/Resources
    /Applications/Doxygen.app/Contents/MacOS
99
  DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
100
)
101

102 103 104
if(DOXYGEN_EXECUTABLE)
  execute_process(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
105

106
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
107
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSION_VAR DOXYGEN_VERSION)
108

109 110 111
#
# Find Dot...
#
112

113 114 115 116 117 118 119
set(_x86 "(x86)")
file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS
  "$ENV{ProgramFiles}/Graphviz*/bin"
  "$ENV{ProgramFiles${_x86}}/Graphviz*/bin"
  )
unset(_x86)

120 121
if(NOT DOXYGEN_SKIP_DOT)
  find_program(DOXYGEN_DOT_EXECUTABLE
122
    NAMES dot
123
    PATHS
124
      ${_Doxygen_GRAPHVIZ_BIN_DIRS}
125 126 127 128 129 130 131 132
      "$ENV{ProgramFiles}/ATT/Graphviz/bin"
      "C:/Program Files/ATT/Graphviz/bin"
      [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
      /Applications/Graphviz.app/Contents/MacOS
      /Applications/Doxygen.app/Contents/Resources
      /Applications/Doxygen.app/Contents/MacOS
    DOC "Graphviz Dot tool for using Doxygen"
  )
133

134
  if(DOXYGEN_DOT_EXECUTABLE)
135
    set(DOXYGEN_DOT_FOUND TRUE)
136
    # The Doxyfile wants the path to Dot, not the entire path and executable
137
    get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH)
138
  endif()
139

140
endif()
141 142 143 144

#
# Backwards compatibility...
#
145

146 147
if(APPLE)
  # Restore the old app-bundle setting setting
148
  set(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE})
149
endif()
150

151 152 153 154 155 156 157 158 159 160 161 162
# Maintain the _FOUND variables as "YES" or "NO" for backwards compatibility
# (allows people to stuff them directly into Doxyfile with configure_file())
if(DOXYGEN_FOUND)
  set(DOXYGEN_FOUND "YES")
else()
  set(DOXYGEN_FOUND "NO")
endif()
if(DOXYGEN_DOT_FOUND)
  set(DOXYGEN_DOT_FOUND "YES")
else()
  set(DOXYGEN_DOT_FOUND "NO")
endif()
Bill Hoffman's avatar
Bill Hoffman committed
163

164
# For backwards compatibility support
165 166
set (DOXYGEN ${DOXYGEN_EXECUTABLE} )
set (DOT ${DOXYGEN_DOT_EXECUTABLE} )
167

168
mark_as_advanced(
169 170
  DOXYGEN_EXECUTABLE
  DOXYGEN_DOT_EXECUTABLE
171
  )