summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-07-30 12:03:35 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-07-30 12:03:35 -0400
commit3062a63364d6c213cb501809c727ff828eb9acae (patch)
tree800fe72699f25b6df1b83704073ab2a1d1cf11fb /cmake
parente5975f36d7f00cb5bca7b2532bfcfb3130d2a069 (diff)
downloadlibgit2-3062a63364d6c213cb501809c727ff828eb9acae.tar.gz
cmake: extended futimens checking on macOSethomson/futimens
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Findfutimens.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/Findfutimens.cmake b/cmake/Findfutimens.cmake
new file mode 100644
index 000000000..73b79528a
--- /dev/null
+++ b/cmake/Findfutimens.cmake
@@ -0,0 +1,14 @@
+INCLUDE(EnableWarnings)
+
+IF (APPLE)
+ # We cannot simply CHECK_FUNCTION_EXISTS on macOS because
+ # MACOSX_DEPLOYMENT_TARGET may be set to a version in the past
+ # that doesn't have futimens. Instead we need to enable warnings
+ # as errors, then check for the symbol existing in `sys/stat.h`,
+ # then reset warnings as errors.
+ ENABLE_WARNINGS(error)
+ CHECK_SYMBOL_EXISTS(futimens sys/stat.h HAVE_FUTIMENS)
+ DISABLE_WARNINGS(error)
+ELSE ()
+ CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
+ENDIF ()