Skip to content

Commit 30fe676

Browse files
committed
Fix tests CMakeLists.txt on MinGW
1 parent 9fd43f3 commit 30fe676

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

cmake/GhcHelper.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ macro(AddTestExecutableWithStdCpp cppStd)
7474
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
7575
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
7676
endif()
77+
if(MINGW)
78+
target_compile_options(filesystem_test_cpp${cppStd} PUBLIC "-Wa,-mbig-obj")
79+
endif()
7780
if(EMSCRIPTEN)
7881
set_target_properties(filesystem_test_cpp${cppStd} PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
7982
endif()

test/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ else()
3838
message("Generating test runner for normal test...")
3939
add_executable(filesystem_test filesystem_test.cpp catch.hpp)
4040
target_link_libraries(filesystem_test ghc_filesystem)
41+
if(MINGW)
42+
target_compile_options(filesystem_test PUBLIC "-Wa,-mbig-obj")
43+
endif()
4144
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
4245
target_link_libraries(filesystem_test xnet)
4346
endif()
@@ -59,10 +62,13 @@ else()
5962
add_executable(filesystem_test_char filesystem_test.cpp catch.hpp)
6063
target_link_libraries(filesystem_test_char ghc_filesystem)
6164
SetTestCompileOptions(filesystem_test_char)
65+
if(MINGW)
66+
target_compile_options(filesystem_test_char PUBLIC "-Wa,-mbig-obj")
67+
endif()
6268
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
63-
target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
69+
target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
6470
else()
65-
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
71+
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
6672
endif()
6773
ParseAndAddCatchTests(filesystem_test_char)
6874
endif()
@@ -90,6 +96,9 @@ SetTestCompileOptions(fwd_impl_test)
9096
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
9197
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
9298
endif()
99+
if(MINGW)
100+
target_compile_options(fwd_impl_test PUBLIC "-Wa,-mbig-obj")
101+
endif()
93102
add_test(fwd_impl_test fwd_impl_test)
94103

95104
add_executable(exception exception.cpp)

0 commit comments

Comments
 (0)