From 95cd2e17ab346b9aec0e40383b4effde23652c47 Mon Sep 17 00:00:00 2001
From: John Galt <johngaltfirstrun@gmail.com>
Date: Thu, 9 Jul 2020 11:25:10 -0400
Subject: [PATCH] cmake: fix fmt linking when found

This is a new attempt at #4206 that shouldn't break windows builds.

If someone else could test on windows, it would be much appreciated.
Previously, the build bot passed but the actual builds failed.
---
 src/common/CMakeLists.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index d120c8d3d9..423bef0f56 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -191,5 +191,9 @@ endif()
 create_target_directory_groups(common)
 find_package(Boost 1.71 COMPONENTS context headers REQUIRED)
 
-target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile)
+if (fmt_FOUND)
+    target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt microprofile)
+else()
+    target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile)
+endif()
 target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd xbyak)