fltk/documentation/CMakeLists.txt
Albrecht Schlosser 720b84ef9d CMake: refactor and reformat CMake files
- raise minimum CMake version from 2.6.3 to 3.2.3 (Jun 01, 2015)
- indent all CMake files according to the CMP (2 col.)
- refactor FLTK version number definitions and usage
- unify CMake and autoconf/configure variable names:
  - FL_VERSION -> FLTK_VERSION
  - FL_MAJOR_VERSION -> FLTK_VERSION_MAJOR
  - etc. for _MINOR_ and _PATCH_, respectively
  - note: this does not affect FL_VERSION etc. in source code
- generate "export headers" for all libraries (experimental: OFF)
- port some forgotten goodies from branch-1.3 to master
- merge and improve macro 'create_example' (WIP)
- remove "temporary" options and code for older CMake versions
- include and use 'GenerateExportHeader' (experimental, WIP: OFF)
  - note: created header files are not yet used
- build only *one* DLL with Visual Studio (tested, works)
  - similar to the bundled IDE projects in 1.3.x
- add some dynamically linked test/demo programs ('*-shared')
  if shared libraries are built (WIP)
- split 'macros.cmake': use one file per macro
2020-07-15 00:34:53 +02:00

146 lines
3.3 KiB
CMake

#
# CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org)
#
# Copyright 1998-2020 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please see the following page on how to report bugs and issues:
#
# https://www.fltk.org/bugs.php
#
set (DOCS)
if (OPTION_INCLUDE_DRIVER_DOCUMENTATION)
set (DRIVER_DOCS "DriverDev")
else ()
set (DRIVER_DOCS "")
endif ()
#--------------------------
# build html documentation
#--------------------------
if (OPTION_BUILD_HTML_DOCUMENTATION)
list (APPEND DOCS html)
# generate Doxygen file "Doxyfile"
set (GENERATE_HTML YES)
set (GENERATE_LATEX NO)
set (LATEX_HEADER "")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/tiny.png
${CMAKE_CURRENT_BINARY_DIR}/html/tiny.png
COPYONLY
)
# generate html docs
add_custom_target (html
# ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating HTML documentation" VERBATIM
)
endif (OPTION_BUILD_HTML_DOCUMENTATION)
#--------------------------
# build pdf documentation
#--------------------------
if (OPTION_BUILD_PDF_DOCUMENTATION)
list (APPEND DOCS pdf)
# generate Doxygen file "Doxybook"
set (GENERATE_HTML NO)
set (GENERATE_LATEX YES)
set (LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxybook
@ONLY
)
# generate LaTeX header fltk-book.tex
set (DOXY_VERSION ${DOXYGEN_VERSION})
execute_process (COMMAND date +%Y
OUTPUT_VARIABLE YEAR
)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/fltk-book.tex.in
${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex
@ONLY
)
# generate fltk.pdf
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
COMMAND ${DOXYGEN_EXECUTABLE} Doxybook
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf
COMMAND cp -f latex/refman.pdf fltk.pdf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating PDF documentation" VERBATIM
)
# add target 'pdf'
add_custom_target (pdf
# ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
)
endif (OPTION_BUILD_PDF_DOCUMENTATION)
#----------------------------------
# add target 'docs' for all docs
#----------------------------------
if (DOCS)
add_custom_target(docs
# ALL
DEPENDS ${DOCS}
)
endif (DOCS)
#----------------------------------
# install html + pdf documentation
#----------------------------------
if (OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${FLTK_DATADIR}/doc/fltk
)
endif (OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
if (OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
DESTINATION ${FLTK_DATADIR}/doc/fltk/
)
endif (OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)