diff options
author | Edward Thomson <ethomson@github.com> | 2021-07-31 09:45:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-31 09:45:30 -0400 |
commit | e65229ee972c113413eeca77853213352129bd47 (patch) | |
tree | e43c0ba287ed2fbfe5c657897e2734a9ee23f6ab | |
parent | f6b3f72634821a9fc899783964edf86f50087cad (diff) | |
parent | 3062a63364d6c213cb501809c727ff828eb9acae (diff) | |
download | libgit2-e65229ee972c113413eeca77853213352129bd47.tar.gz |
Merge pull request #5962 from libgit2/ethomson/futimens
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | cmake/Findfutimens.cmake | 14 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 58214fd0e..ff3411928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ INCLUDE(AddCFlagIfSupported) INCLUDE(FindPkgLibraries) INCLUDE(FindThreads) INCLUDE(FindStatNsec) +INCLUDE(Findfutimens) INCLUDE(GNUInstallDirs) INCLUDE(IdeSplitSources) INCLUDE(FeatureSummary) 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 () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8d1559551..d3408999f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,10 +38,10 @@ IF(ENABLE_TRACE) ENDIF() ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support") -CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS) IF (HAVE_FUTIMENS) SET(GIT_USE_FUTIMENS 1) ENDIF () +ADD_FEATURE_INFO(futimens GIT_USE_FUTIMENS "futimens support") CHECK_PROTOTYPE_DEFINITION(qsort_r "void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *))" |