From 8679c87aa44fac82b416d086dfdf3ae69d1e200e Mon Sep 17 00:00:00 2001 From: Tim Niklas Uhl Date: Mon, 9 Sep 2024 11:24:34 +0200 Subject: [PATCH] Change compiler flag for serialization to enabling instead of disabling. (#748) * Change compiler flag for serialization to enabling instead of disabling. * . --- CMakeLists.txt | 2 +- include/kamping/serialization.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f2e3ec5..43c6520c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,9 +215,9 @@ if (KAMPING_ENABLE_SERIALIZATION) message(STATUS "Cereal: building from source.") endif () target_link_libraries(kamping_base INTERFACE cereal::cereal) + target_compile_definitions(kamping_base INTERFACE KAMPING_ENABLE_SERIALIZATION) message(STATUS "Serialization: enabled") else () - target_compile_definitions(kamping_base INTERFACE KAMPING_DISABLE_SERIALIZATION) message(STATUS "Serialization: disabled") endif () diff --git a/include/kamping/serialization.hpp b/include/kamping/serialization.hpp index 698a317e..ed579d15 100644 --- a/include/kamping/serialization.hpp +++ b/include/kamping/serialization.hpp @@ -17,14 +17,14 @@ #include -#if !defined(KAMPING_DISABLE_SERIALIZATION) +#ifdef KAMPING_ENABLE_SERIALIZATION #include "cereal/archives/binary.hpp" #endif #include "kamping/data_buffer.hpp" namespace kamping { namespace internal { -#if !defined(KAMPING_DISABLE_SERIALIZATION) +#ifdef KAMPING_ENABLE_SERIALIZATION /// @brief Buffer holding serialized data. /// @@ -103,7 +103,7 @@ struct serialization_support_tag {}; /// @brief Type trait to check if a type is a serialization buffer. template constexpr bool is_serialization_buffer_v_impl = false; -#if !defined(KAMPING_DISABLE_SERIALIZATION) +#ifdef KAMPING_ENABLE_SERIALIZATION /// @brief Type trait to check if a type is a serialization buffer. template constexpr bool is_serialization_buffer_v_impl> = true; @@ -128,7 +128,7 @@ auto deserialization_repack(BufferType buffer) { } } } // namespace internal -#if !defined(KAMPING_DISABLE_SERIALIZATION) +#ifdef KAMPING_ENABLE_SERIALIZATION /// @brief Serializes an object using [`cereal`](https://uscilab.github.io/cereal/). /// @tparam Archive Type of the archive to use for serialization (see /// https://uscilab.github.io/cereal/serialization_archives.html). Default is `cereal::BinaryOutputArchive`.