diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 81edea5b61..3e994514c5 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -11,6 +11,12 @@ // NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif +#if defined(__APPLE__) +// Restore Darwin APIs removed by _POSIX_C_SOURCE: +// aligned_alloc +// NOLINTNEXTLINE(bugprone-reserved-identifier) +# define _DARWIN_C_SOURCE +#endif #include "cmLoadCommandCommand.h" diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index 27225280d6..e39deb0a90 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -23,6 +23,12 @@ // NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif +#if defined(__APPLE__) +// Restore Darwin APIs removed by _POSIX_C_SOURCE: +// aligned_alloc +// NOLINTNEXTLINE(bugprone-reserved-identifier) +# define _DARWIN_C_SOURCE +#endif #include "cmsys/Configure.h" // IWYU pragma: keep diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 4d8bc027d8..e3e3e25381 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -11,6 +11,13 @@ // NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif +#if defined(__APPLE__) +// Restore Darwin APIs removed by _POSIX_C_SOURCE: +// aligned_alloc +// timespec_get +// NOLINTNEXTLINE(bugprone-reserved-identifier) +# define _DARWIN_C_SOURCE +#endif #include "cmTimestamp.h"