diff --git a/CMakeLists.txt b/CMakeLists.txt index 4508ec33..532af9ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,12 @@ else() set(LCI_LIBRARIES ${LCI_LIBRARIES} dl) endif() +FetchContent_Declare( + fmt + URL "https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz" + FIND_PACKAGE_ARGS) + +set(SPDLOG_FMT_EXTERNAL ON) FetchContent_Declare( spdlog URL "https://github.com/gabime/spdlog/archive/v1.14.1.tar.gz" @@ -173,7 +179,15 @@ FetchContent_Declare( URL_HASH "SHA256=e91779044cd4025ec10ed31986031031ef22ebce90a64cc8f85e7c7e95a1abc6" FIND_PACKAGE_ARGS) -FetchContent_MakeAvailable(spdlog yaml-cpp) +# Set BUILD_SHARED_LIBS=OFF to prevent fmt and spdlog from being built as shared +# libraries. +set(LIBLOOT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) +set(BUILD_SHARED_LIBS OFF) + +FetchContent_MakeAvailable(fmt spdlog yaml-cpp) + +# Restore the original value of BUILD_SHARED_LIBS. +set(BUILD_SHARED_LIBS ${LIBLOOT_BUILD_SHARED_LIBS}) ############################## # General Settings @@ -301,7 +315,8 @@ target_link_libraries(loot PRIVATE ${ESPLUGIN_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LCI_LIBRARIES} - spdlog::spdlog_header_only + fmt::fmt + spdlog::spdlog yaml-cpp::yaml-cpp) ############################## diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 62e0594f..ebccd821 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -117,7 +117,8 @@ target_link_libraries(libloot_internals_tests PRIVATE ${ESPLUGIN_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LCI_LIBRARIES} - spdlog::spdlog_header_only + fmt::fmt + spdlog::spdlog yaml-cpp::yaml-cpp GTest::gtest_main) diff --git a/src/api/bsa.cpp b/src/api/bsa.cpp index dab45365..7fd34939 100644 --- a/src/api/bsa.cpp +++ b/src/api/bsa.cpp @@ -24,6 +24,7 @@ #include "api/bsa.h" +#include #include #include diff --git a/src/api/helpers/crc.cpp b/src/api/helpers/crc.cpp index 307b2d05..10173807 100644 --- a/src/api/helpers/crc.cpp +++ b/src/api/helpers/crc.cpp @@ -24,8 +24,9 @@ #include "api/helpers/crc.h" -#include +#include +#include #include #include diff --git a/src/api/metadata/yaml/message.h b/src/api/metadata/yaml/message.h index 8991082f..8b4a68bf 100644 --- a/src/api/metadata/yaml/message.h +++ b/src/api/metadata/yaml/message.h @@ -26,8 +26,7 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS -#include -#include +#include #include #include diff --git a/src/api/sorting/plugin_graph.h b/src/api/sorting/plugin_graph.h index 77ce102e..b776fb78 100644 --- a/src/api/sorting/plugin_graph.h +++ b/src/api/sorting/plugin_graph.h @@ -25,10 +25,6 @@ #ifndef LOOT_API_SORTING_PLUGIN_SORTER #define LOOT_API_SORTING_PLUGIN_SORTER -#define FMT_NO_FMT_STRING_ALIAS - -#include - #include #include #include