From 64010cf797dd3d24acb015417b39686b349a18c0 Mon Sep 17 00:00:00 2001 From: Yuri Konotopov Date: Mon, 9 Nov 2020 04:28:43 +0400 Subject: [PATCH] Support build with system fmt (#3838) Signed-off-by: Yuri Konotopov --- CMakeLists.txt | 5 ----- cmake/SearchForStuff.cmake | 12 ++++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bc43a8e3c..a8dd6e2ea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,6 @@ if(NOT NO_TRANSLATION) endif() endif() -# 3rdpary Libraries -if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt/fmt") - add_subdirectory(3rdparty/fmt/fmt) -endif() - # make common if(common_libs) add_subdirectory(common/src/Utilities) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 0ad848b04d..5dabd85623 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -242,3 +242,15 @@ if((GCC_VERSION VERSION_EQUAL "9.0" OR GCC_VERSION VERSION_GREATER "9.0") AND GC Even with that patch, compiling with LTO may still segfault. Use at your own risk! This text being in a compile log in an open issue may cause it to be closed.") endif() + +find_package(fmt "7.0.3" QUIET) +if(NOT fmt_FOUND) + if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt/fmt/CMakeLists.txt") + message(STATUS "No system fmt was found. Using bundled") + add_subdirectory(3rdparty/fmt/fmt) + else() + message(FATAL_ERROR "No system or bundled fmt was found") + endif() +else() + message(STATUS "Found fmt: ${fmt_VERSION}") +endif()