Build: Work around `futimes` detection bug
@@ -6,7 +6,13 @@ include(TestBigEndian)
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV)
check_symbol_exists(setenv "stdlib.h" HAVE_SETENV)
check_symbol_exists(futimens "sys/stat.h" HAVE_FUTIMENS)
+
+# Work around a bug on macOS where `futimes` can not be located if we specify the compiler switch `-Werror`
+set (CMAKE_C_FLAGS_OLD ${CMAKE_C_FLAGS})
+string (REPLACE "-Werror" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
check_symbol_exists(futimes "sys/time.h" HAVE_FUTIMES)
+set (CMAKE_C_FLAGS ${CMAKE_C_FLAGS_OLD})
+
check_symbol_exists(glob "glob.h" HAVE_GLOB)
check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
