From b9cb0f74df8ca74f927afa9818e155ea10110ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Thirud?= Date: Thu, 11 May 2023 12:03:11 +0200 Subject: [PATCH] Added CMake-support for commonly used preprocessor directives. - ELPP_FORCE_USE_STD_THREAD - ELPP_NO_DEFAULT_LOG_FILE - ELPP_THREAD_SAFE --- CHANGELOG.md | 5 +++++ CMakeLists.txt | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247463183..1b0ceb5e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [9.97.1] - 11-05-2023 + +### Features + * CMake support for flags ELPP_FORCE_USE_STD_THREAD, ELPP_NO_DEFAULT_LOG_FILE and ELPP_THREAD_SAFE + ## [9.97.0] - 25-12-2020 ### Features * Support for QNX OS diff --git a/CMakeLists.txt b/CMakeLists.txt index 538cc8a0b..9221dab9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,10 @@ option(test "Build all tests" OFF) option(build_static_lib "Build easyloggingpp as a static library" OFF) option(lib_utc_datetime "Build library with UTC date/time logging" OFF) +option(no_default_logfile "Do not write to default log file \"myeasylog.log\" (define ELPP_NO_DEFAULT_LOG_FILE)" OFF) +option(thread_safe "Build easyloggingpp thread safe (define ELPP_THREAD_SAFE)" OFF) +option(use_std_threads "Use standard library thread synchronization (define ELPP_FORCE_USE_STD_THREAD)" OFF) + set(ELPP_MAJOR_VERSION "9") set(ELPP_MINOR_VERSION "96") set(ELPP_PATCH_VERSION "7") @@ -57,6 +61,18 @@ if (build_static_lib) add_definitions(-DELPP_UTC_DATETIME) endif() + if (no_default_logfile) + add_definitions(-DELPP_NO_DEFAULT_LOG_FILE) + endif() + + if (thread_safe) + add_definitions(-DELPP_THREAD_SAFE) + endif() + + if (use_std_threads) + add_definitions(-DELPP_FORCE_USE_STD_THREAD) + endif() + require_cpp11() add_library(easyloggingpp STATIC src/easylogging++.cc) set_property(TARGET easyloggingpp PROPERTY POSITION_INDEPENDENT_CODE ON)