summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2018-10-03 07:49:17 -0400
committerMaxim Biro <nurupo.contributions@gmail.com>2018-10-07 15:15:58 -0400
commitf5afc526550d935585f4023142853eeb95115734 (patch)
tree5631d20eb74e06b57b752d9619d28cd552277b4b /CMakeLists.txt
parent11e1f63f54356aa6fcedea348a7be73aac81d051 (diff)
Default to not defining MIN_LOGGER_LEVEL in CMake
That way CMake's behavior matches what autotools does -- letting toxcore/logger.h handle the default case.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 10 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d68eb801..435cdad3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,18 +93,17 @@ else()
93 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}") 93 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}")
94endif() 94endif()
95 95
96option(DEBUG "Enable DEBUG level logging (default)" ON) 96set(MIN_LOGGER_LEVEL "" CACHE STRING "Logging level to use (TRACE, DEBUG, INFO, WARNING, ERROR)")
97if(DEBUG)
98 set(MIN_LOGGER_LEVEL DEBUG)
99endif()
100
101option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
102if(TRACE)
103 set(MIN_LOGGER_LEVEL TRACE)
104endif()
105
106if(MIN_LOGGER_LEVEL) 97if(MIN_LOGGER_LEVEL)
107 add_definitions(-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_${MIN_LOGGER_LEVEL}) 98 if(("${MIN_LOGGER_LEVEL}" STREQUAL "TRACE") OR
99 ("${MIN_LOGGER_LEVEL}" STREQUAL "DEBUG") OR
100 ("${MIN_LOGGER_LEVEL}" STREQUAL "INFO") OR
101 ("${MIN_LOGGER_LEVEL}" STREQUAL "WARNING") OR
102 ("${MIN_LOGGER_LEVEL}" STREQUAL "ERROR"))
103 add_definitions(-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_${MIN_LOGGER_LEVEL})
104 else()
105 message(FATAL_ERROR "Unknown value provided for MIN_LOGGER_LEVEL: \"${MIN_LOGGER_LEVEL}\", must be one of TRACE, DEBUG, INFO, WARNING or ERROR")
106 endif()
108endif() 107endif()
109 108
110option(USE_IPV6 "Use IPv6 in tests" ON) 109option(USE_IPV6 "Use IPv6 in tests" ON)