From 16b117c12164d254eba741bea6c037b7f1746c4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Mon, 30 Oct 2017 07:51:20 +0100
Subject: Pthread needs -lpthread on Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a20962..31e8670 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,7 +185,11 @@ if(NOT MSVC)
   #
   # And because we also support MinGW and its `windres` compiler, we have to avoid passing -pthread to *that* thing, so,
   # well, let's cheat and put it into the CXXFLAGS.
-  set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}")
+  if(NOT HAIKU)
+    set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}")
+  else()
+    set(CMAKE_CXX_FLAGS "-lpthread ${CMAKE_CXX_FLAGS}")
+  endif()
 endif()
 
 # Make sure that plugins not export all symbols, only that which are explicitly marked
-- 
2.14.2


From e311c4e7d70c12d0f29be4f6e007347db1fb0cfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Mon, 30 Oct 2017 08:04:51 +0100
Subject: Haiku got no -ldl


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31e8670..1d6d5b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -809,7 +809,11 @@ if(BUILD_TESTING)
 
       add_library(fake-dev-random SHARED ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils/fake-dev-random.c)
       set_target_properties(fake-dev-random PROPERTIES AUTOMOC off)
-      target_link_libraries(fake-dev-random dl)
+      if(NOT HAIKU)
+        target_link_libraries(fake-dev-random dl)
+      else()
+        target_link_libraries(fake-dev-random root)
+      endif()
 
       # FIXME: it would be nice to depend on the contents of keys/, but in my testing it produces Makefiles
       # which suffer from races (the keygen.sh is run multiple times in parallel within the CI environment).
-- 
2.14.2
