$OpenBSD: patch-CMakeLists_txt,v 1.12 2021/07/29 12:38:20 sthen Exp $

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -198,12 +198,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
 	set(BSD TRUE)
 	if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
 		set(FREEBSD TRUE)
+		set(EPOLLSHIM TRUE)
 	endif()
 	if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
 		set(KFREEBSD TRUE)
 	endif()
 	if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
 		set(OPENBSD TRUE)
+		set(EPOLLSHIM TRUE)
 	endif()
 endif()
 
@@ -212,11 +214,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
 	set(FREEBSD TRUE)
 endif()
 
-if(FREEBSD)
+if(EPOLLSHIM)
 	find_path(EPOLLSHIM_INCLUDE_DIR NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim)
 	find_library(EPOLLSHIM_LIBS NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
 endif()
 
+find_library(EXECINFO_LIBS NAMES execinfo)
+
 # Configure MSVC Runtime
 if(MSVC)
 	include(MSVCRuntime)
@@ -636,12 +640,13 @@ if(UNIX OR CYGWIN)
 	if (HAVE_SYS_EVENTFD_H)
 		check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE)
 	endif()
-	if (FREEBSD)
+	if (EPOLLSHIM)
 		list(APPEND CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
 	endif()
 	check_include_files(sys/timerfd.h HAVE_SYS_TIMERFD_H)
-	if (FREEBSD)
+	if (EPOLLSHIM)
 		list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
+		list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EXECINFO_INCLUDE_DIR})
 	endif()
 	check_include_files(poll.h HAVE_POLL_H)
 	list(APPEND CMAKE_REQUIRED_LIBRARIES m)
