diff --git Source/cmLoadCommandCommand.cxx Source/cmLoadCommandCommand.cxx
index 3e994514c5..de6f1f03e6 100644
--- Source/cmLoadCommandCommand.cxx
+++ Source/cmLoadCommandCommand.cxx
@@ -18,6 +18,13 @@
 #  define _DARWIN_C_SOURCE
 #endif
 
+#if defined(__APPLE__)
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+# undef _POSIX_C_SOURCE
+# endif
+# endif
+
 #include "cmLoadCommandCommand.h"
 
 #include <csignal>
diff --git Source/cmStandardLexer.h Source/cmStandardLexer.h
index e39deb0a90..72614511f3 100644
--- Source/cmStandardLexer.h
+++ Source/cmStandardLexer.h
@@ -30,6 +30,13 @@
 #  define _DARWIN_C_SOURCE
 #endif
 
+#if defined(__APPLE__)
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+# undef _POSIX_C_SOURCE
+# endif
+# endif
+
 #include "cmsys/Configure.h" // IWYU pragma: keep
 
 /* Disable some warnings.  */
diff --git Source/cmSystemTools.cxx Source/cmSystemTools.cxx
index 5ad0439c9e..d2195a8247 100644
--- Source/cmSystemTools.cxx
+++ Source/cmSystemTools.cxx
@@ -18,6 +18,13 @@
 #  define _DARWIN_C_SOURCE
 #endif
 
+#if defined(__APPLE__)
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+# undef _POSIX_C_SOURCE
+# endif
+# endif
+
 #include "cmSystemTools.h"
 
 #include <cm/optional>
diff --git Source/cmTimestamp.cxx Source/cmTimestamp.cxx
index e3e3e25381..51d85bf4bf 100644
--- Source/cmTimestamp.cxx
+++ Source/cmTimestamp.cxx
@@ -19,6 +19,13 @@
 #  define _DARWIN_C_SOURCE
 #endif
 
+#if defined(__APPLE__)
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+# undef _POSIX_C_SOURCE
+# endif
+# endif
+
 #include "cmTimestamp.h"
 
 #include <cstdlib>
-- 
2.43.0

