[geos-commits] [SCM] GEOS branch main updated. c05da7dacd42ad55f77bc7ef980e53bab5a012a8

git at osgeo.org git at osgeo.org
Wed Sep 17 16:09:50 PDT 2025


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main has been updated
       via  c05da7dacd42ad55f77bc7ef980e53bab5a012a8 (commit)
      from  1126a86b8fc01a8c05a161cfd8f3a38a95395205 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c05da7dacd42ad55f77bc7ef980e53bab5a012a8
Author: Mike Taves <mwtoews at gmail.com>
Date:   Thu Sep 18 11:09:26 2025 +1200

    Add CMake check for std::filesystem availability (#1303)

diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 3c172f1bc..063c408ff 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -14,6 +14,35 @@ file(GLOB_RECURSE _sources ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
 add_executable(test_geos_unit ${_sources})
 unset(_sources)
 
+# test that std::filesystem header actually is there and works
+if(NOT CMAKE_REQUIRED_QUIET)
+  # CMake 3.17+ use CHECK_START/CHECK_PASS/CHECK_FAIL
+  message(STATUS "Checking if compiler supports std::filesystem")
+endif()
+set(_filename "${CMAKE_CURRENT_BINARY_DIR}/has_filesystem.cpp")
+write_file(${_filename} "\
+#include <filesystem>
+int main() {
+  std::filesystem::path pth {\"../\"};
+  return 0;
+}")
+try_compile(HAVE_STD_FILESYSTEM "${CMAKE_BINARY_DIR}/temp" "${_filename}")
+file(REMOVE "${_filename}")
+unset(_filename)
+if(HAVE_STD_FILESYSTEM)
+  if(NOT CMAKE_REQUIRED_QUIET)
+    # CMake 3.17+ use CHECK_START/CHECK_PASS/CHECK_FAIL
+    message(STATUS "Checking if compiler supports std::filesystem - yes")
+  endif()
+  target_compile_definitions(test_geos_unit PRIVATE HAVE_STD_FILESYSTEM)
+else()
+  if(NOT CMAKE_REQUIRED_QUIET)
+    # CMake 3.17+ use CHECK_START/CHECK_PASS/CHECK_FAIL
+    message(STATUS "Checking if compiler supports std::filesystem - no")
+  endif()
+  target_compile_definitions(test_geos_unit PRIVATE HAVE_STD_FILESYSTEM=0)
+endif()
+
 find_package(Threads)
 
 target_link_libraries(test_geos_unit PRIVATE geos geos_c Threads::Threads)
diff --git a/tests/unit/utility.h b/tests/unit/utility.h
index 575b4a928..a4ddbe6a8 100644
--- a/tests/unit/utility.h
+++ b/tests/unit/utility.h
@@ -33,11 +33,13 @@
 #include <fstream>
 #include <sstream>
 
+#ifndef HAVE_STD_FILESYSTEM
 #if defined(__GNUC__) && !defined(__clang__)
 #define HAVE_STD_FILESYSTEM (__GNUC__ > 8)
 #else
 #define HAVE_STD_FILESYSTEM 1
 #endif
+#endif /* ifndef HAVE_STD_FILESYSTEM */
 #if HAVE_STD_FILESYSTEM
 #include <filesystem>
 #endif

-----------------------------------------------------------------------

Summary of changes:
 tests/unit/CMakeLists.txt | 29 +++++++++++++++++++++++++++++
 tests/unit/utility.h      |  2 ++
 2 files changed, 31 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list