diff --git a/CMakeLists.txt b/CMakeLists.txt index 01a07b0..4d43ebc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,9 @@ endif() if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) + if(NOT CYGWIN) + set(CMAKE_CXX_EXTENSIONS OFF) + endif() endif() if(CMAKE_CXX_STANDARD LESS 11) message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, ghc::filesystem only works with C++11 and above.") diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake index 78665d2..f7cdb52 100644 --- a/cmake/GhcHelper.cmake +++ b/cmake/GhcHelper.cmake @@ -29,6 +29,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) target_link_libraries(${targetName} -lstdc++fs) endif() + target_compile_options(${targetName} PRIVATE $<$:-Wa,-mbig-obj>) target_compile_definitions(${targetName} PRIVATE USE_STD_FS) endif() @@ -50,7 +51,8 @@ macro(AddTestExecutableWithStdCpp cppStd) $<$:-s DISABLE_EXCEPTION_CATCHING=0> $<$,$>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations> $<$:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations> - $<$:/WX /wd4996>) + $<$:/WX /wd4996> + $<$:-Wa,-mbig-obj>) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS) endif() diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index e09bef3..12a67e3 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -65,6 +65,8 @@ #elif defined(_WIN32) #define GHC_OS_WINDOWS #define GHC_OS_WIN32 +#elif defined(__CYGWIN__) +#define GHC_OS_CYGWIN #elif defined(__svr4__) #define GHC_OS_SYS5R4 #elif defined(BSD) @@ -166,6 +168,9 @@ #else #include #endif +#ifdef GHC_OS_CYGWIN +#include +#endif #if !defined(__ANDROID__) || __ANDROID_API__ >= 26 #include #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a8ea09b..debe93a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,8 @@ else() $<$:-s DISABLE_EXCEPTION_CATCHING=0> $<$,$>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror> $<$:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror> - $<$:/WX>) + $<$:/WX> + $<$:-Wa,-mbig-obj>) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS) endif() @@ -60,6 +61,12 @@ add_test(multifile_test multifile_test) add_executable(fwd_impl_test fwd_test.cpp impl_test.cpp) target_link_libraries(fwd_impl_test ghc_filesystem) +target_compile_options(fwd_impl_test PRIVATE + $<$:-s DISABLE_EXCEPTION_CATCHING=0> + $<$,$>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror> + $<$:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror> + $<$:/WX> + $<$:-Wa,-mbig-obj>) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS) endif() @@ -70,3 +77,9 @@ if(NOT MSVC) target_compile_options(exception PRIVATE -fno-exceptions) endif() target_include_directories(exception PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include) +target_compile_options(exception PRIVATE + $<$:-s DISABLE_EXCEPTION_CATCHING=0> + $<$,$>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror> + $<$:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror> + $<$:/WX> + $<$:-Wa,-mbig-obj>)