From 0d3e04cb5a14284ba293575dea76a31ea6b102ca Mon Sep 17 00:00:00 2001
From: Daniel Lyubomirov <dennislt@gmail.com>
Date: Mon, 15 Jun 2020 12:21:08 +0300
Subject: [PATCH] Fix windows tests build

---
 cpp/CMakeLists.txt               | 5 ++++-
 cpp/src/CMakeLists.txt           | 4 ++--
 cpp/tests/util/protobuf.cc       | 1 -
 cpp/tests/vereign/CMakeLists.txt | 5 ++++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index b347034..6989dc4 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -10,7 +10,7 @@ project (vereign)
 option(VEREIGN_USE_LLD "Use the lld linker" OFF)
 option(VEREIGN_USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF)
 option(VEREIGN_USE_TIME_TRACE "Use compilation profiler" OFF)
-option(VEREIGN_ENABLE_BENCHMARKING "Enable tests benchmarks" ON)
+option(VEREIGN_ENABLE_BENCHMARKING "Enable tests benchmarks" OFF)
 
 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
   if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.24215.1")
@@ -106,6 +106,9 @@ include(ProtoGenerate)
 enable_testing()
 
 find_package(fmt 6.2.0 REQUIRED)
+if (fmt_FOUND)
+  get_target_property(fmt_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
+endif()
 
 set(OPENSSL_USE_STATIC_LIBS ON)
 set(OPENSSL_ROOT_DIR ${VENDOR_INSTALL_DIR}/boringssl)
diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt
index ed74694..5555155 100644
--- a/cpp/src/CMakeLists.txt
+++ b/cpp/src/CMakeLists.txt
@@ -61,12 +61,13 @@ add_library(vereignlib STATIC ${VEREIGNLIB_SRC})
 set_property(TARGET vereignlib PROPERTY POSITION_INDEPENDENT_CODE ON)
 target_link_libraries(vereignlib PRIVATE
   nlohmann_json::nlohmann_json
-  fmt::fmt
 )
 target_link_libraries(vereignlib PUBLIC
   vereignproto
+  fmt::fmt
   gRPC::grpc++_reflection
   gRPC::grpc++
+  $<$<CXX_COMPILER_ID:MSVC>:Boost::date_time>
 )
 
 add_library(vereign SHARED
@@ -77,7 +78,6 @@ target_include_directories(vereign
 )
 target_link_libraries(vereign PRIVATE
   vereignlib
-  $<$<CXX_COMPILER_ID:MSVC>:Boost::date_time>
 )
 if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
   # Set the DLLEXPORT variable to export symbols
diff --git a/cpp/tests/util/protobuf.cc b/cpp/tests/util/protobuf.cc
index 5350ab1..05e1c79 100644
--- a/cpp/tests/util/protobuf.cc
+++ b/cpp/tests/util/protobuf.cc
@@ -2,7 +2,6 @@
 #include <util/protobuf.hh>
 
 #include <google/protobuf/util/json_util.h>
-#include <fmt/core.h>
 
 #include <catch2/catch.hpp>
 
diff --git a/cpp/tests/vereign/CMakeLists.txt b/cpp/tests/vereign/CMakeLists.txt
index 4deb797..2c2b6fc 100644
--- a/cpp/tests/vereign/CMakeLists.txt
+++ b/cpp/tests/vereign/CMakeLists.txt
@@ -1,12 +1,15 @@
 
+if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+  add_definitions(-DNOGDI)
+endif()
 
 include_directories(
   ${CMAKE_SOURCE_DIR}/src
   ${VENDOR_INSTALL_DIR}/include
   ${CMAKE_SOURCE_DIR}/proto/cpp
+  ${Boost_INCLUDE_DIRS}
 )
 
-
 list(APPEND tests_src
   init_tests.cc
   ../util/protobuf.cc
-- 
GitLab