summaryrefslogtreecommitdiffstats
path: root/Utilities/Doxygen/CMakeLists.txt
blob: 6ebf2b4cd1fc2a1578c36c5bd0f1986173316fb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
#
# 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.
#=============================================================================

if(NOT CMake_SOURCE_DIR)
  set(CMakeDeveloperReference_STANDALONE 1)
  cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
  get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
  get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
  include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
  include(${CMake_SOURCE_DIR}/Source/CMakeVersionCompute.cmake)
  include(${CMake_SOURCE_DIR}/Source/CMakeInstallDestinations.cmake)
  unset(CMAKE_DATA_DIR)
  unset(CMAKE_DATA_DIR CACHE)
  macro(CMake_OPTIONAL_COMPONENT)
    set(COMPONENT "")
  endmacro()
endif()

project(CMakeDeveloperReference NONE)

#
# Build the reference
#

if (CMake_BUILD_DEVELOPER_REFERENCE OR CMakeDeveloperReference_STANDALONE)

  find_package(Doxygen REQUIRED)

  #
  ## Output formats
  #

  option(CMake_BUILD_DEVELOPER_REFERENCE_HTML "Build CMake Developer Reference - HTML format" ON)
  mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
  if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
    set(GENERATE_HTML YES)
  else()
    set(GENERATE_HTML NO)
  endif()

  option(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP "Build CMake Developer Reference - QtHelp format" OFF)
  mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
  if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
    set(GENERATE_QHP YES)
    find_program(QHELPGENERATOR_EXECUTABLE
      NAMES qhelpgenerator
      DOC "qhelpgenerator tool"
      )
    if(NOT QHELPGENERATOR_EXECUTABLE)
      message(FATAL_ERROR "QHELPGENERATOR_EXECUTABLE (qhelpgenerator) not found!")
    endif()
  else()
    set(GENERATE_QHP NO)
  endif()

  #
  # Configure the script and the doxyfile, then add target
  #

  if(DOXYGEN_DOT_FOUND)
    set(HAVE_DOT YES)
  else()
    set(HAVE_DOT NO)
  endif()

  if(NOT DOT_PATH)
    get_filename_component(DOT_PATH ${DOXYGEN_DOT_EXECUTABLE} PATH)
  endif()

  configure_file(doxyfile.in doxyfile @ONLY)

  add_custom_target(cmake-developer-reference-all
    ${DOXYGEN_EXECUTABLE} doxyfile
    WORKING_DIRECTORY ${CMakeDeveloperReference_BINARY_DIR})

  add_custom_target(cmake-developer-reference ALL DEPENDS cmake-developer-reference-all)

  #
  # Installation
  #

  if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
    CMake_OPTIONAL_COMPONENT(cmake-developer-reference-html)
    install(DIRECTORY "${CMakeDeveloperReference_BINARY_DIR}/developer-reference/html"
      DESTINATION ${CMAKE_DOC_DIR}/developer-reference
      ${COMPONENT})
  endif()

  if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
    CMake_OPTIONAL_COMPONENT(cmake-developer-reference-qthelp)
    install(FILES "${CMakeDeveloperReference_BINARY_DIR}/developer-reference/CMakeDeveloperReference-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch"
      DESTINATION ${CMAKE_DOC_DIR}/developer-reference
      ${COMPONENT})
  endif()

endif ()