Work around MinGW O_NONBLOCK error in Abseil Abseil 20260817.0's cctz/src/time_zone_info.cc guards the Windows fopen_s path on _MSC_VER and omits #ifndef O_NONBLOCK in the POSIX fallback, breaking MinGW (ucrt64) builds until a future LTS patch includes upstream commit ddbdebc6c8. Append O_NONBLOCK=0 via set_property(SOURCE ... DIRECTORY ... APPEND) only on time_zone_info.cc across both absl/ (abseil_dll) and absl/time/ (static/shared time_zone) under if (MINGW). Change-Id: I0493e112eec154bbc1c762793c40361dc1571b31
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ab5de5..1d64d09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -235,6 +235,16 @@ option(ABSL_ENABLE_INSTALL "Enable install rules" ON) add_subdirectory(third_party/abseil-cpp) + if (MINGW) + # Abseil 20260817.0 omits #ifndef O_NONBLOCK in cctz/src/time_zone_info.cc + # (fixed upstream in abseil-cpp commit ddbdebc6c8). + set_property( + SOURCE "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc" + DIRECTORY + "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/absl" + "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/absl/time" + APPEND PROPERTY COMPILE_DEFINITIONS "O_NONBLOCK=0") + endif() export(EXPORT abslTargets FILE "${Ceres_BINARY_DIR}/third_party/abseil-cpp/abslTargets.cmake" NAMESPACE absl::)