summaryrefslogtreecommitdiff
path: root/doc/CMakeLists.txt
blob: f2cc4d9ccca4b983deda0a012cca582240896360 (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
add_subdirectory(reference)

#
# API docs
#
macro(_join_list _var _sep)
  set(${_var} "")
  foreach(_element ${ARGN})
    set(${_var} "${${_var}}${_sep}${_element}")
  endforeach()
endmacro()

find_package(Doxygen)
set_package_properties(Doxygen PROPERTIES
  TYPE OPTIONAL
  DESCRIPTION "API Documentation system"
  URL "http://www.doxygen.org"
  PURPOSE "Needed to build the API documentation."
)
if(DOXYGEN_FOUND)
  file(GLOB _dox_deps *.dox *.html *.md ${CMAKE_SOURCE_DIR}/README.md)
  file(GLOB _all_hdrs
    ${CMAKE_SOURCE_DIR}/src/libical/*.h
    ${CMAKE_SOURCE_DIR}/src/libical/*.c
    ${CMAKE_SOURCE_DIR}/src/libical/*.cxx
    ${CMAKE_BINARY_DIR}/src/libical/*.c
    ${CMAKE_BINARY_DIR}/src/libical/*.h

    ${CMAKE_SOURCE_DIR}/src/libicalss/*.h
    ${CMAKE_SOURCE_DIR}/src/libicalss/*.c
    ${CMAKE_SOURCE_DIR}/src/libicalss/*.cxx
    ${CMAKE_BINARY_DIR}/src/libicalss/*.c
    ${CMAKE_BINARY_DIR}/src/libicalss/*.h

    ${CMAKE_SOURCE_DIR}/src/libicalvcal/*.h
    ${CMAKE_SOURCE_DIR}/src/libicalvcal/*.c
    ${CMAKE_SOURCE_DIR}/src/libicalvcal/*.cxx
    ${CMAKE_BINARY_DIR}/src/libicalvcal/*.c
    ${CMAKE_BINARY_DIR}/src/libicalvcal/*.h
  )
  list(APPEND _all_hdrs ${_dox_deps})
  _join_list(DOXYGEN_INPUT " " ${_all_hdrs})

  #apidox generation using doxygen
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
    ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  )

  add_custom_command(
    OUTPUT ${CMAKE_BINARY_DIR}/apidocs/html/index.html
    COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
    DEPENDS ${_all_hdrs} ${_dox_deps} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
    COMMENT "Run Doxygen"
  )
  add_custom_target(docs
    DEPENDS ${CMAKE_BINARY_DIR}/apidocs/html/index.html
    COMMENT "Target to build the documentation"
  )
  add_dependencies(docs ical icalss icalvcal)
  if(WITH_CXX_BINDINGS)
    add_dependencies(docs ical_cxx icalss_cxx)
  endif()
endif()