From f977ffc9822b3344974c116598e9b511066b1d35 Mon Sep 17 00:00:00 2001 From: Jose Alves Date: Fri, 25 Apr 2025 16:27:15 +0200 Subject: [PATCH] fix build and runtime issues with hash tests usinc c/c++ --- test/CMakeLists.txt | 8 ++++++++ test/hash_functions/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 566c0e6d8..de2c0a3a8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,6 +2,14 @@ if (NOT TARGET "test-drive::test-drive") find_package("test-drive" REQUIRED) endif() +if(WIN32) + if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel") + add_link_options(/Qoption,link,/STACK:8388608) + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) + add_link_options(-Wl,--stack,8388608) + endif() +endif() + macro(ADDTEST name) add_executable(test_${name} test_${name}.f90) target_link_libraries(test_${name} "${PROJECT_NAME}" "test-drive::test-drive") diff --git a/test/hash_functions/CMakeLists.txt b/test/hash_functions/CMakeLists.txt index bcaf23fec..4e8fc35bb 100755 --- a/test/hash_functions/CMakeLists.txt +++ b/test/hash_functions/CMakeLists.txt @@ -23,6 +23,21 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel") set(CMAKE_CXX_EXTENSIONS OFF) set_target_properties(test_hash_functions PROPERTIES LINKER_LANGUAGE Fortran) + + if(WIN32) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL$<$:Debug>") + target_compile_options( + test_hash_functions + PRIVATE + $<$:/libs:dll> ) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR "RelWithDebInfo") + target_link_options(test_hash_functions + PRIVATE + /Qoption,link,/NODEFAULTLIB:libcmt + /Qoption,link,/NODEFAULTLIB:msvcrt.lib + /Qoption,link,/NODEFAULTLIB:libifcoremt.lib ) + endif() + endif() endif() if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)