From 833f2996bca0801b8196e19eff20a467a5c0ca13 Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Sun, 23 Mar 2014 23:26:02 -0500 Subject: [PATCH 1/2] Fix MSVC static/shared library mismatch with gtest. --- test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a141df9..462110b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,5 @@ +set(gtest_force_shared_crt ${MSVC_SHARED_RT} CACHE BOOL + "Use shared (DLL) run-time lib even when Google Test built as a static lib.") add_subdirectory(gmock-1.7.0) include_directories(gmock-1.7.0/gtest/include) include_directories(gmock-1.7.0/include) From fe8ca77a1bca3c380a4014489a4b2615569745f0 Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Sun, 23 Mar 2014 23:56:17 -0500 Subject: [PATCH 2/2] Add missing DLL export, and set up gtest/gmock to properly import their symbols. --- include/yaml-cpp/ostream_wrapper.h | 4 +++- test/CMakeLists.txt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/yaml-cpp/ostream_wrapper.h b/include/yaml-cpp/ostream_wrapper.h index cc2ef56..1f0a080 100644 --- a/include/yaml-cpp/ostream_wrapper.h +++ b/include/yaml-cpp/ostream_wrapper.h @@ -10,8 +10,10 @@ #include #include +#include "yaml-cpp/dll.h" + namespace YAML { -class ostream_wrapper { +class YAML_CPP_API ostream_wrapper { public: ostream_wrapper(); explicit ostream_wrapper(std::ostream& stream); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 462110b..7108a65 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,6 +4,10 @@ add_subdirectory(gmock-1.7.0) include_directories(gmock-1.7.0/gtest/include) include_directories(gmock-1.7.0/include) +if(WIN32 AND BUILD_SHARED_LIBS) + add_definitions("-DGTEST_LINKED_AS_SHARED_LIBRARY") +endif() + file(GLOB test_headers [a-z_]*.h) file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp) file(GLOB test_core_sources core/[a-z]*.cpp)