1 #=============================================================================
2 # CMake - Cross Platform Makefile Generator
3 # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12 SUBDIRS(Doxygen KWStyle)
14 MAKE_DIRECTORY(${CMake_BINARY_DIR}/Docs)
16 # Add a documentation target.
20 ${CMake_BINARY_DIR}/Docs/cmake.1
21 ${CMake_BINARY_DIR}/Docs/cmakecommands.1
22 ${CMake_BINARY_DIR}/Docs/cmakecompat.1
23 ${CMake_BINARY_DIR}/Docs/cmakeprops.1
24 ${CMake_BINARY_DIR}/Docs/cmakepolicies.1
25 ${CMake_BINARY_DIR}/Docs/cmakevars.1
26 ${CMake_BINARY_DIR}/Docs/cmakemodules.1
29 ${CMake_BINARY_DIR}/Docs/cmake.txt
30 ${CMake_BINARY_DIR}/Docs/cmake.docbook
31 ${CMake_BINARY_DIR}/Docs/cmake-policies.txt
32 ${CMake_BINARY_DIR}/Docs/cmake-properties.txt
33 ${CMake_BINARY_DIR}/Docs/cmake-variables.txt
34 ${CMake_BINARY_DIR}/Docs/cmake-modules.txt
35 ${CMake_BINARY_DIR}/Docs/cmake-commands.txt
36 ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.txt
39 ${CMake_BINARY_DIR}/Docs/cmake.html
40 ${CMake_BINARY_DIR}/Docs/cmake-policies.html
41 ${CMake_BINARY_DIR}/Docs/cmake-properties.html
42 ${CMake_BINARY_DIR}/Docs/cmake-variables.html
43 ${CMake_BINARY_DIR}/Docs/cmake-modules.html
44 ${CMake_BINARY_DIR}/Docs/cmake-commands.html
45 ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.html
48 MACRO(ADD_DOCS target dependency)
49 # Generate documentation for "ctest" executable.
50 GET_TARGET_PROPERTY(CMD ${target} LOCATION)
51 # only generate the documentation if the target is actually built
54 OUTPUT ${CMake_BINARY_DIR}/Docs/${target}.txt
55 ${${target}-PATH} # Possibly set PATH, see below.
57 ARGS --help-full ${CMake_BINARY_DIR}/Docs/${target}.txt
58 --help-full ${CMake_BINARY_DIR}/Docs/${target}.html
59 --help-full ${CMake_BINARY_DIR}/Docs/${target}.1
60 --help-full ${CMake_BINARY_DIR}/Docs/${target}.docbook
62 MAIN_DEPENDENCY ${dependency}
64 SET(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/${target}.txt)
65 LIST(APPEND MAN_FILES ${CMake_BINARY_DIR}/Docs/${target}.1)
66 LIST(APPEND TEXT_FILES
67 ${CMake_BINARY_DIR}/Docs/${target}.txt
68 ${CMake_BINARY_DIR}/Docs/${target}.docbook
70 LIST(APPEND HTML_FILES ${CMake_BINARY_DIR}/Docs/${target}.html)
72 ENDMACRO(ADD_DOCS target dependency)
74 # Help cmake-gui find the Qt DLLs on Windows.
75 SET(WIN_SHELL_GENS "Visual Studio|NMake|MinGW|Watcom|Borland")
76 IF(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}"
77 AND EXISTS "${QT_QMAKE_EXECUTABLE}" AND NOT CMAKE_NO_AUTO_QT_ENV)
78 GET_FILENAME_COMPONENT(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
79 IF(EXISTS "${Qt_BIN_DIR}/QtCore4.dll")
80 # Tell the macro to set the path before running cmake-gui.
81 STRING(REPLACE ";" "\\;" _PATH "PATH=${Qt_BIN_DIR};%PATH%")
82 SET(cmake-gui-PATH COMMAND set "${_PATH}")
83 ENDIF(EXISTS "${Qt_BIN_DIR}/QtCore4.dll")
84 ENDIF(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}"
85 AND EXISTS "${QT_QMAKE_EXECUTABLE}" AND NOT CMAKE_NO_AUTO_QT_ENV)
87 # add the docs for the executables
88 ADD_DOCS(ctest ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt)
89 ADD_DOCS(cpack ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt)
90 ADD_DOCS(ccmake ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt)
91 ADD_DOCS(CMakeSetup ${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in)
92 ADD_DOCS(cmake-gui ${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in)
94 # add the documentation for cmake itself
96 GET_TARGET_PROPERTY(CMD cmake LOCATION)
98 OUTPUT ${CMake_BINARY_DIR}/Docs/cmake.txt
100 ARGS --copyright ${CMake_BINARY_DIR}/Docs/Copyright.txt
101 --help-full ${CMake_BINARY_DIR}/Docs/cmake.txt
102 --help-full ${CMake_BINARY_DIR}/Docs/cmake.html
103 --help-full ${CMake_BINARY_DIR}/Docs/cmake.1
104 --help-full ${CMake_BINARY_DIR}/Docs/cmake.docbook
105 --help-policies ${CMake_BINARY_DIR}/Docs/cmake-policies.txt
106 --help-policies ${CMake_BINARY_DIR}/Docs/cmake-policies.html
107 --help-policies ${CMake_BINARY_DIR}/Docs/cmakepolicies.1
108 --help-properties ${CMake_BINARY_DIR}/Docs/cmake-properties.txt
109 --help-properties ${CMake_BINARY_DIR}/Docs/cmake-properties.html
110 --help-properties ${CMake_BINARY_DIR}/Docs/cmakeprops.1
111 --help-variables ${CMake_BINARY_DIR}/Docs/cmake-variables.txt
112 --help-variables ${CMake_BINARY_DIR}/Docs/cmake-variables.html
113 --help-variables ${CMake_BINARY_DIR}/Docs/cmakevars.1
114 --help-modules ${CMake_BINARY_DIR}/Docs/cmake-modules.txt
115 --help-modules ${CMake_BINARY_DIR}/Docs/cmake-modules.html
116 --help-modules ${CMake_BINARY_DIR}/Docs/cmakemodules.1
117 --help-commands ${CMake_BINARY_DIR}/Docs/cmake-commands.txt
118 --help-commands ${CMake_BINARY_DIR}/Docs/cmake-commands.html
119 --help-commands ${CMake_BINARY_DIR}/Docs/cmakecommands.1
120 --help-compatcommands ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.txt
121 --help-compatcommands ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.html
122 --help-compatcommands ${CMake_BINARY_DIR}/Docs/cmakecompat.1
124 MAIN_DEPENDENCY ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt
127 INSTALL_FILES(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES})
128 INSTALL_FILES(${CMAKE_DOC_DIR} FILES ${HTML_FILES} ${TEXT_FILES})
129 INSTALL(FILES cmake.m4 DESTINATION share/aclocal)
131 # Drive documentation generation.
132 ADD_CUSTOM_TARGET(documentation ALL DEPENDS ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/cmake.txt )
134 # Documentation testing.
136 find_package(LibXml2 QUIET)
137 if(NOT DEFINED LIBXML2_XMLLINT_EXECUTABLE)
138 find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
140 mark_as_advanced(LIBXML2_XMLLINT_EXECUTABLE)
141 if(LIBXML2_XMLLINT_EXECUTABLE)
142 execute_process(COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --help
143 OUTPUT_VARIABLE _help ERROR_VARIABLE _err)
144 if("${_help}" MATCHES "--path" AND "${_help}" MATCHES "--nonet")
145 # We provide the XHTML DTD and its dependencies in the 'xml'
146 # directory so that xmllint can run without network access.
147 # However, it's --path option accepts a space-separated list of
148 # paths so it cannot handle spaces in the path to the source tree.
149 # Therefore we run the tool with the current work directory set to
150 # the 'xml' directory and use '.' as the path.
152 ${CMAKE_CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/xml
153 ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet --path .