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.
This commit is contained in:
Maxim Biro 2018-10-03 07:49:17 -04:00
parent 11e1f63f54
commit f5afc52655
No known key found for this signature in database
GPG Key ID: 76E9A6E7D9E20DFE
7 changed files with 29 additions and 31 deletions

View File

@ -56,7 +56,7 @@ travis_script() {
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="_install" \
-DTRACE=ON \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \

View File

@ -91,7 +91,7 @@ travis_script() {
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DTRACE=ON \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \

View File

@ -28,7 +28,7 @@ travis_script() {
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DTRACE=ON \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DUSE_IPV6=OFF

View File

@ -30,7 +30,7 @@ travis_script() {
-e ENABLE_ARCH_i686=$i686 \
-e ENABLE_ARCH_x86_64=$x86_64 \
-e ENABLE_TEST=true \
-e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DDEBUG=ON -DTEST_TIMEOUT_SECONDS=90" \
-e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DMIN_LOGGER_LEVEL=DEBUG -DTEST_TIMEOUT_SECONDS=90" \
-e DCMAKE_C_FLAGS="$C_FLAGS" \
-e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
-e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \

View File

@ -93,18 +93,17 @@ else()
message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}")
endif()
option(DEBUG "Enable DEBUG level logging (default)" ON)
if(DEBUG)
set(MIN_LOGGER_LEVEL DEBUG)
endif()
option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
if(TRACE)
set(MIN_LOGGER_LEVEL TRACE)
endif()
set(MIN_LOGGER_LEVEL "" CACHE STRING "Logging level to use (TRACE, DEBUG, INFO, WARNING, ERROR)")
if(MIN_LOGGER_LEVEL)
if(("${MIN_LOGGER_LEVEL}" STREQUAL "TRACE") OR
("${MIN_LOGGER_LEVEL}" STREQUAL "DEBUG") OR
("${MIN_LOGGER_LEVEL}" STREQUAL "INFO") OR
("${MIN_LOGGER_LEVEL}" STREQUAL "WARNING") OR
("${MIN_LOGGER_LEVEL}" STREQUAL "ERROR"))
add_definitions(-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_${MIN_LOGGER_LEVEL})
else()
message(FATAL_ERROR "Unknown value provided for MIN_LOGGER_LEVEL: \"${MIN_LOGGER_LEVEL}\", must be one of TRACE, DEBUG, INFO, WARNING or ERROR")
endif()
endif()
option(USE_IPV6 "Use IPv6 in tests" ON)

View File

@ -82,18 +82,17 @@ There is some experimental accommodation for building natively on Windows, i.e.
There are some options that are available to configure the build.
| Name | Description | Expected Value | Default Value |
|------------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------|---------------------------------------------------|
|------------------------|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|---------------------------------------------------|
| `BOOTSTRAP_DAEMON` | Enable building of tox-bootstrapd, the DHT bootstrap node daemon. For Unix-like systems only. | ON or OFF | ON |
| `BUILD_AV_TEST` | Build toxav test. | ON or OFF | ON |
| `BUILD_TOXAV` | Whether to build the tox AV library. | ON or OFF | ON |
| `CMAKE_INSTALL_PREFIX` | Path to where everything should be installed. | Directory path. | Platform-dependent. Refer to CMake documentation. |
| `DEBUG` | Enable assertions and other debugging facilities. | ON or OFF | OFF |
| `DHT_BOOTSTRAP` | Enable building of `DHT_bootstrap` | ON or OFF | ON |
| `ENABLE_SHARED` | Build shared (dynamic) libraries for all modules. | ON or OFF | ON |
| `ENABLE_STATIC` | Build static libraries for all modules. | ON or OFF | ON |
| `MIN_LOGGER_LEVEL` | Logging level to use. | TRACE, DEBUG, INFO, WARNING, ERROR or nothing (empty string) for default. | Empty string. |
| `STRICT_ABI` | Enforce strict ABI export in dynamic libraries. | ON or OFF | OFF |
| `TEST_TIMEOUT_SECONDS` | Limit runtime of each test to the number of seconds specified. | Positive number or nothing (empty string). | Empty string. |
| `TRACE` | Enable TRACE level logging (expensive, for network debugging). | ON or OFF | OFF |
| `USE_IPV6` | Use IPv6 in tests. | ON or OFF | ON |
You can get this list of option using the following commands
@ -110,7 +109,7 @@ Example of calling cmake with options
```sh
cmake \
-D ENABLE_STATIC=OFF \
-D DEBUG=ON \
-D MIN_LOGGER_LEVEL=DEBUG \
-D CMAKE_INSTALL_PREFIX=/opt \
-D TEST_TIMEOUT_SECONDS=120 \
..

View File

@ -82,7 +82,7 @@ AC_ARG_WITH(log-level,
elif test "x$withval" = "xERROR"; then
AC_DEFINE([MIN_LOGGER_LEVEL], [LOGGER_LEVEL_ERROR], [Logger_Level value])
else
AC_MSG_WARN([Invalid logger level: $withval. Using default 'DEBUG'])
AC_MSG_WARN([Invalid logger level: $withval. Using default.])
fi
]
)