From 802eaadd2d52563e1bb91272dcc5104c6ebebe8a Mon Sep 17 00:00:00 2001 From: steven lunt Date: Wed, 19 May 2021 10:45:33 -0400 Subject: [PATCH] add macros for overriding the individual level names --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6258defd..56dcd41b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,6 +235,38 @@ if(SPDLOG_NO_EXCEPTIONS AND NOT MSVC) target_compile_options(spdlog PRIVATE -fno-exceptions) endif() +# --------------------------------------------------------------------------------------- +# Allow override of level names +# --------------------------------------------------------------------------------------- +if(NOT SPDLOG_LEVEL_NAME_TRACE) + set(SPDLOG_LEVEL_NAME_TRACE trace) +endif() +if(NOT SPDLOG_LEVEL_NAME_DEBUG) + set(SPDLOG_LEVEL_NAME_DEBUG debug) +endif() +if(NOT SPDLOG_LEVEL_NAME_INFO) + set(SPDLOG_LEVEL_NAME_INFO info) +endif() +if(NOT SPDLOG_LEVEL_NAME_WARNING) + set(SPDLOG_LEVEL_NAME_WARNING warning) +endif() +if(NOT SPDLOG_LEVEL_NAME_ERROR) + set(SPDLOG_LEVEL_NAME_ERROR error) +endif() +if(NOT SPDLOG_LEVEL_NAME_CRITICAL) + set(SPDLOG_LEVEL_NAME_CRITICAL critical) +endif() +if(NOT SPDLOG_LEVEL_NAME_OFF) + set(SPDLOG_LEVEL_NAME_OFF off) +endif() +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_TRACE=\"${SPDLOG_LEVEL_NAME_TRACE}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_DEBUG=\"${SPDLOG_LEVEL_NAME_DEBUG}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_INFO=\"${SPDLOG_LEVEL_NAME_INFO}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_WARNING=\"${SPDLOG_LEVEL_NAME_WARNING}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_ERROR=\"${SPDLOG_LEVEL_NAME_ERROR}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_CRITICAL=\"${SPDLOG_LEVEL_NAME_CRITICAL}\") +target_compile_definitions(spdlog PUBLIC SPDLOG_LEVEL_NAME_OFF=\"${SPDLOG_LEVEL_NAME_OFF}\") + # --------------------------------------------------------------------------------------- # Build binaries # ---------------------------------------------------------------------------------------