Skip to content

Commit

Permalink
Added CMake_BUILD_DEVELOPER_REFERENCE option
Browse files Browse the repository at this point in the history
By default is OFF and marked as advanced.

It's also add custom cmake-developer-reference (ALL) target

Generated output will be installed to ${CMAKE_DOC_DIR}/developer-reference.
  • Loading branch information
podsvirov committed Aug 16, 2016
1 parent 6b07972 commit c18dc6f
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 292 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ option(CMake_INSTALL_DEPENDENCIES
"Whether to install 3rd-party runtime dependencies" OFF)
mark_as_advanced(CMake_INSTALL_DEPENDENCIES)

# option to build reference for CMake developers
option(CMake_BUILD_DEVELOPER_REFERENCE
"Build CMake Developer Reference" OFF)
mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE)

#-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script
Expand Down
9 changes: 9 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
endif()

# configure the .dox.in file
if(CMake_BUILD_DEVELOPER_REFERENCE)
configure_file(
"${CMake_SOURCE_DIR}/Source/dir.dox.in"
"${CMake_BINARY_DIR}/Source/dir.dox"
@ONLY
)
endif()

# configure the .h file
configure_file(
"${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
Expand Down
Binary file added Source/QtDialog/CMakeSetup64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Source/dir.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*!

\dir

\brief Root \c ${CMake_SOURCE_DIR}/Source directory

*/
7 changes: 7 additions & 0 deletions Source/dir.dox.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*!

\dir

\brief Generated \c ${CMake_BINARY_DIR}/Source directory

*/
92 changes: 79 additions & 13 deletions Utilities/Doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,96 @@
# 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 documentation
# Build the reference
#
include (${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)

if (BUILD_DOCUMENTATION)
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 ${DOT} PATH)
get_filename_component(DOT_PATH ${DOXYGEN_DOT_EXECUTABLE} PATH)
endif()

configure_file(
${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in
${CMake_BINARY_DIR}/Utilities/Doxygen/doxyfile)
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)

configure_file(
${CMake_SOURCE_DIR}/Utilities/Doxygen/doc_makeall.sh.in
${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh)
#
# Installation
#

add_custom_target(DoxygenDoc
${BASH}
${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh)
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 ()
8 changes: 8 additions & 0 deletions Utilities/Doxygen/DeveloperReference/mainpage.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*!

\mainpage CMake Developer Reference

This manual is intended for reference by developers modifying the CMake
source tree itself.

*/
17 changes: 0 additions & 17 deletions Utilities/Doxygen/authors.txt

This file was deleted.

Loading

0 comments on commit c18dc6f

Please sign in to comment.