From 80bcfeec338a00c13ffe68fc14c512e46229f611 Mon Sep 17 00:00:00 2001
From: Shuanglei Tao <tsl0922@gmail.com>
Date: Sat, 16 Mar 2019 11:17:36 +0800
Subject: [PATCH] cmake: fix compile on macOS

---
 CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bba1f7e..2381e8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,7 +69,12 @@ list(APPEND SOURCE_FILES html.h)
 set(INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR} ${LIBWEBSOCKETS_INCLUDE_DIR} ${JSON-C_INCLUDE_DIR})
 set(LINK_LIBS pthread ${OPENSSL_LIBRARIES} ${LIBWEBSOCKETS_LIBRARIES} ${JSON-C_LIBRARY})
 
-if(NOT APPLE)
+if(APPLE)
+    # required for the new homebrew version of libwebsockets
+    find_path(LIBUV_INCLUDE_DIR NAMES uv.h)
+    find_path(LIBEVENT_INCLUDE_DIR NAMES event2/event.h)
+    list(APPEND INCLUDE_DIRS ${LIBUV_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR})
+else()
     list(APPEND LINK_LIBS util)
 endif()
 
-- 
2.43.4