From 9afa948a7765b651ae99e528ed7c56a31198371e Mon Sep 17 00:00:00 2001
From: Charles Villard <charles.villard@cea.fr>
Date: Fri, 13 Dec 2024 11:21:27 +0000
Subject: [PATCH] Change fmt library to system and upgrade Catch2

---
 CMakeLists.txt              | 5 ++++-
 include/aidge/data/Elts.hpp | 4 ++--
 unit_tests/CMakeLists.txt   | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index beec9fbb4..3a1dc22b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,9 +115,12 @@ if (PYBIND)
     include(PybindDependency)
     add_pybind_dependency(${module_name})
     ##
+
+    target_link_libraries(${pybind_module_name} PRIVATE fmt::fmt)
 endif()
 
-target_link_libraries(${module_name} PUBLIC Threads::Threads fmt::fmt)
+target_link_libraries(${module_name} PRIVATE fmt::fmt)
+target_link_libraries(${module_name} PUBLIC Threads::Threads)
 target_compile_features(${module_name} PRIVATE cxx_std_14)
 
 if (DOSANITIZE STREQUAL "ON")
diff --git a/include/aidge/data/Elts.hpp b/include/aidge/data/Elts.hpp
index 1a5a9e10e..bc4a225fc 100644
--- a/include/aidge/data/Elts.hpp
+++ b/include/aidge/data/Elts.hpp
@@ -101,12 +101,12 @@ private:
 template<>
 struct fmt::formatter<Aidge::Elts_t> {
     template<typename ParseContext>
-    inline constexpr auto parse(ParseContext& ctx) {
+    inline constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
         return ctx.begin();
     }
 
     template<typename FormatContext>
-    inline auto format(Aidge::Elts_t const& elt, FormatContext& ctx) {
+    inline auto format(const Aidge::Elts_t& elt, FormatContext& ctx) const {
         return fmt::format_to(ctx.out(), "{}:{}", elt.data, elt.token);
     }
 };
diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt
index 2c0c746a4..8257a6063 100644
--- a/unit_tests/CMakeLists.txt
+++ b/unit_tests/CMakeLists.txt
@@ -63,6 +63,7 @@ endif()
 target_link_libraries(tests${module_name} PRIVATE ${module_name})
 
 target_link_libraries(tests${module_name} PRIVATE Catch2::Catch2WithMain)
+target_link_libraries(tests${module_name} PRIVATE fmt::fmt)
 
 list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
 include(CTest)
-- 
GitLab