Fix building with (mostly) default flags on Windows MinGW

It's already being done for Cygwin, presumably for the same reasons.
Clang auto-applies `-mbig-obj` as needed it seems:
https://reviews.llvm.org/D102419

Tests against `std::filesystem` remain broken, though, and building
with MinGW still requires disabling them manually with
`-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO`:
https://github.com/gulrak/filesystem/issues/189#issuecomment-2571334165
This commit is contained in:
500-internal-server-error 2025-02-19 20:24:57 +07:00
parent 84fa1ac50a
commit d7d5e314db
No known key found for this signature in database
GPG Key ID: 9877C47604EE72C2
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(${targetName} network)
endif()
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
target_compile_options(${targetName} PRIVATE $<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>)
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@ -69,7 +69,7 @@ macro(AddTestExecutableWithStdCpp cppStd)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
$<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)

View File

@ -14,7 +14,7 @@ function(SetTestCompileOptions target_name)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
$<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>)
endfunction()
if(GHC_COVERAGE)