File: check_doxygen_errors.cmake

package info (click to toggle)
geos 3.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,212 kB
  • sloc: cpp: 199,103; xml: 56,065; ansic: 6,162; sh: 287; makefile: 26
file content (50 lines) | stat: -rw-r--r-- 1,635 bytes parent folder | download | duplicates (2)
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
################################################################################
# Part of CMake configuration for GEOS
#
# Script checking the doxygen logfile for errors and warnings, which are not
# accepted. Throws FATAL_ERROR if found.
#
# Copyright (C) 2019 Nicklas Larsson <n_larsson@yahoo.com>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
################################################################################

file(TO_NATIVE_PATH ${DOXYGEN_LOGFILE} DOXYGEN_LOGFILE)

if(EXISTS "${DOXYGEN_LOGFILE}")
  set(ERRORS "")
  file(READ "${DOXYGEN_LOGFILE}" LOGFILE)

  # convert file content to list
  string(REGEX REPLACE "\n$" "" LOGFILE "${LOGFILE}")
  string(REGEX REPLACE ";" "\\\\;" LOGFILE "${LOGFILE}")
  string(REGEX REPLACE "\n" ";" LOGFILE "${LOGFILE}")

  # let's not forget non-fatal warnings
  list(LENGTH LOGFILE NUM_WARNINGS)
  if(NUM_WARNINGS GREATER 0)
    message(STATUS
      "Doxygen issued ${NUM_WARNINGS} warning(s), see ${DOXYGEN_LOGFILE}")
  endif()

  foreach(LINE ${LOGFILE})
    string(REGEX MATCH
      ".*(not documented|ignoring unsupported tag|tag without matching).*" IGNORE ${LINE})
    if("${IGNORE}" STREQUAL "")
      list(APPEND ERRORS ${LINE})
    endif()
  endforeach()

  if(NOT "${ERRORS}" STREQUAL "")
    # convert list to string
    string(REGEX REPLACE ";" "\n" ERROR_MSG "${ERRORS}")
    message(FATAL_ERROR "${ERROR_MSG}")
  endif()

  unset(ERRORS)
endif()

message(STATUS "Doxygen documentation is OK")