From 30fe67624eb10eafc0305f156b81c8eddb017a35 Mon Sep 17 00:00:00 2001 From: Oz Date: Sat, 16 Sep 2023 19:45:12 +0200 Subject: [PATCH] Fix tests CMakeLists.txt on MinGW --- cmake/GhcHelper.cmake | 3 +++ test/CMakeLists.txt | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake index 4d9e5a0..f1ea554 100644 --- a/cmake/GhcHelper.cmake +++ b/cmake/GhcHelper.cmake @@ -74,6 +74,9 @@ macro(AddTestExecutableWithStdCpp cppStd) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS) endif() + if(MINGW) + target_compile_options(filesystem_test_cpp${cppStd} PUBLIC "-Wa,-mbig-obj") + endif() if(EMSCRIPTEN) set_target_properties(filesystem_test_cpp${cppStd} PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1") endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2275c61..bf3eec3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,6 +38,9 @@ else() message("Generating test runner for normal test...") add_executable(filesystem_test filesystem_test.cpp catch.hpp) target_link_libraries(filesystem_test ghc_filesystem) + if(MINGW) + target_compile_options(filesystem_test PUBLIC "-Wa,-mbig-obj") + endif() if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)") target_link_libraries(filesystem_test xnet) endif() @@ -59,10 +62,13 @@ else() add_executable(filesystem_test_char filesystem_test.cpp catch.hpp) target_link_libraries(filesystem_test_char ghc_filesystem) SetTestCompileOptions(filesystem_test_char) + if(MINGW) + target_compile_options(filesystem_test_char PUBLIC "-Wa,-mbig-obj") + endif() if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) - target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) + target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) else() - target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) + target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) endif() ParseAndAddCatchTests(filesystem_test_char) endif() @@ -90,6 +96,9 @@ SetTestCompileOptions(fwd_impl_test) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX) endif() +if(MINGW) + target_compile_options(fwd_impl_test PUBLIC "-Wa,-mbig-obj") +endif() add_test(fwd_impl_test fwd_impl_test) add_executable(exception exception.cpp)