From aa9f3a82b2c4f0fa1016908c58a375eba185f2d9 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Wed, 20 Sep 2017 09:56:59 -0400 Subject: [PATCH] macOS: Account for deployment target when checking for utimensat The SDK for macOS 10.13 adds `utimensat`, but the symbol is not available at runtime on older macOS versions. Check the deployment target before using the symbol. Issue: cmake/cmake#17101 --- kwsysPlatformTestsCXX.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index 01c69514..e67d4366 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -265,6 +265,12 @@ int main() #ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT #include <fcntl.h> #include <sys/stat.h> +#if defined(__APPLE__) +#include <AvailabilityMacros.h> +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 +#error "utimensat not available on macOS < 10.13" +#endif +#endif int main() { struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } }; -- GitLab