File: SetDebugLevel.cmake

package info (click to toggle)
s3d 0.2.2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,356 kB
  • sloc: ansic: 21,128; python: 488; perl: 98; makefile: 31; sh: 29
file content (30 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (3)
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
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2007-2015  Sven Eckelmann <sven@narfation.org>

# if user set debug level
string(TOUPPER "${DEBUG}" DEBUG_UPPER)
set(DEBUG ${DEBUG}
	CACHE STRING "Set Debug Level"
)

# test debug and convert it so numeric debug_level
set(DEBUG_LEVEL CACHE INTERNAL "Numeric representation of DEBUG")
if (DEBUG_UPPER STREQUAL VLOW)
	set(DEBUG_LEVEL "1")
elseif (DEBUG_UPPER STREQUAL LOW)
	set(DEBUG_LEVEL "2")
elseif (DEBUG_UPPER STREQUAL MED)
	set(DEBUG_LEVEL "3")
elseif (DEBUG_UPPER STREQUAL HIGH)
	set(DEBUG_LEVEL "4")
elseif (DEBUG_UPPER STREQUAL VHIGH)
	set(DEBUG_LEVEL "5")
elseif (DEBUG_UPPER STREQUAL "")
	set(DEBUG)
else (DEBUG_UPPER STREQUAL VLOW)
	message(FATAL_ERROR "No valid debug-level [VLOW|LOW|MED|HIGH|VHIGH] found.")
endif (DEBUG_UPPER STREQUAL VLOW)

if (DEBUG)
	message(STATUS "Set debug level to: ${DEBUG}")
endif (DEBUG)