1 diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
2 index 7625cf65d9..167903e309 100644
3 --- a/Utilities/cmlibuv/CMakeLists.txt
4 +++ b/Utilities/cmlibuv/CMakeLists.txt
5 @@ -193,6 +193,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
10 + include(CheckIncludeFile)
12 + check_include_file("ApplicationServices/ApplicationServices.h" HAVE_ApplicationServices)
13 + if (HAVE_ApplicationServices)
14 + list(APPEND uv_defines
15 + HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H=1
19 + check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
20 + if (HAVE_CoreServices)
21 + list(APPEND uv_defines
22 + HAVE_CORESERVICES_CORESERVICES_H=1
27 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
28 diff --git a/Utilities/cmlibuv/src/unix/fsevents.c b/Utilities/cmlibuv/src/unix/fsevents.c
29 index a51f29b3f6..3f6bf01968 100644
30 --- a/Utilities/cmlibuv/src/unix/fsevents.c
31 +++ b/Utilities/cmlibuv/src/unix/fsevents.c
36 -#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
37 +#if !HAVE_CORESERVICES_CORESERVICES_H || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
39 /* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */
40 /* macOS prior to 10.7 doesn't provide the full FSEvents API so use kqueue */
41 @@ -39,7 +39,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
42 void uv__fsevents_loop_delete(uv_loop_t* loop) {
45 -#else /* TARGET_OS_IPHONE */
46 +#else /* !HAVE_CORESERVICES_CORESERVICES_H */
48 #include "darwin-stub.h"
50 @@ -920,4 +920,4 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
54 -#endif /* TARGET_OS_IPHONE */
55 +#endif /* !HAVE_CORESERVICES_CORESERVICES_H */