From 0e92542cdb4aa08810d034cebb87a8522a046323 Mon Sep 17 00:00:00 2001
From: Bertrand Bellenot <bertrand.bellenot@cern.ch>
Date: Wed, 14 Mar 2018 10:40:35 +0100
Subject: [PATCH] Fix several tests on Windows

---
 test/CMakeLists.txt          | 11 +++++++++++
 test/periodic/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 823a45c5372..68b392bf533 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -117,6 +117,9 @@ ROOT_ADD_TEST(test-stresslinear-interpreted COMMAND ${ROOT_root_CMD} -b -q -l ${
 
 #--stressGraphics------------------------------------------------------------------------------------
 ROOT_EXECUTABLE(stressGraphics stressGraphics.cxx LIBRARIES Graf Gpad Postscript)
+if(MSVC)
+  set_property(TARGET stressGraphics APPEND_STRING PROPERTY LINK_FLAGS "/STACK:4000000")
+endif()
 configure_file(stressGraphics.ref stressGraphics.ref COPYONLY)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../tutorials/graphics/earth.dat earth.dat COPYONLY)
 ROOT_ADD_TEST(test-stressgraphics ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH} COMMAND stressGraphics -b -k FAILREGEX "FAILED|Error in" LABELS longtest)
@@ -177,6 +180,11 @@ ROOT_STANDARD_LIBRARY_PACKAGE(TrackMathCoreDict
                               HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/TrackMathCore.h
                               LINKDEF TrackMathCoreLinkDef.h
                               DEPENDENCIES Core MathCore RIO GenVector Smatrix)
+if(MSVC)
+  add_custom_command(TARGET TrackMathCoreDict POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libTrackMathCoreDict.dll
+                                     ${CMAKE_CURRENT_BINARY_DIR}/libTrackMathCoreDict.dll)
+endif()
 ROOT_EXECUTABLE(stressMathCore stressMathCore.cxx LIBRARIES MathCore Hist RIO Tree GenVector)
 ROOT_ADD_TEST(test-stressmathcore COMMAND stressMathCore FAILREGEX "FAILED|Error in")
 ROOT_ADD_TEST(test-stressmathcore-interpreted COMMAND ${ROOT_root_CMD} -b -q -l ${CMAKE_CURRENT_SOURCE_DIR}/stressMathCore.cxx
@@ -295,6 +303,9 @@ ROOT_ADD_TEST(test-delaunay COMMAND delaunayTriangulation)
 
 #--TestTformula------------------------------------------------------------------------------------
 ROOT_EXECUTABLE(TFormulaTests TFormulaTests.cxx LIBRARIES Hist RIO)
+if(MSVC)
+  set_property(TARGET TFormulaTests APPEND_STRING PROPERTY LINK_FLAGS "/STACK:4000000")
+endif()
 ROOT_ADD_TEST(test-TFormulaTests COMMAND TFormulaTests FAILREGEX "FAILED|Error in")
 
 #--TBB basic test----------------------------------------------------------------------------------
diff --git a/test/periodic/CMakeLists.txt b/test/periodic/CMakeLists.txt
index ebd10c3585b..711a361c94c 100644
--- a/test/periodic/CMakeLists.txt
+++ b/test/periodic/CMakeLists.txt
@@ -13,6 +13,9 @@ ROOT_GENERATE_DICTIONARY(G__NdbDict ${headers} LINKDEF NdbLinkDef.h)
 
 #---Create a shared library with geneated dictionary
 add_library(NdbDict SHARED ${DBsources} G__NdbDict.cxx)
+if(MSVC)
+  set_target_properties(NdbDict PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+endif()
 target_link_libraries(NdbDict ROOT::Core)
 
 #---Create  a main program using the library
-- 
GitLab