diff options
author | Maxim Biro <nurupo.contributions@gmail.com> | 2018-10-03 07:49:17 -0400 |
---|---|---|
committer | Maxim Biro <nurupo.contributions@gmail.com> | 2018-10-07 15:15:58 -0400 |
commit | f5afc526550d935585f4023142853eeb95115734 (patch) | |
tree | 5631d20eb74e06b57b752d9619d28cd552277b4b /CMakeLists.txt | |
parent | 11e1f63f54356aa6fcedea348a7be73aac81d051 (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.txt | 21 |
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}") |
94 | endif() | 94 | endif() |
95 | 95 | ||
96 | option(DEBUG "Enable DEBUG level logging (default)" ON) | 96 | set(MIN_LOGGER_LEVEL "" CACHE STRING "Logging level to use (TRACE, DEBUG, INFO, WARNING, ERROR)") |
97 | if(DEBUG) | ||
98 | set(MIN_LOGGER_LEVEL DEBUG) | ||
99 | endif() | ||
100 | |||
101 | option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF) | ||
102 | if(TRACE) | ||
103 | set(MIN_LOGGER_LEVEL TRACE) | ||
104 | endif() | ||
105 | |||
106 | if(MIN_LOGGER_LEVEL) | 97 | if(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() | ||
108 | endif() | 107 | endif() |
109 | 108 | ||
110 | option(USE_IPV6 "Use IPv6 in tests" ON) | 109 | option(USE_IPV6 "Use IPv6 in tests" ON) |