From 6f6e91c4518dab3b55e0d364ffd4880cd8f08a82 Mon Sep 17 00:00:00 2001 From: Juergen Date: Sat, 11 Nov 2023 23:06:33 +0100 Subject: [PATCH] Fix compilation on FreeBSD --- CMakeLists.txt | 5 +++++ web/httpserver.h | 2 ++ zeroconf/networkhotplugnotifier.cpp | 10 +++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccbdd43..0099b34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) include_directories(.) +if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + include_directories(/usr/local/include) + link_directories(/usr/local/lib) +endif() + if(APPLE) include_directories( /opt/local/include diff --git a/web/httpserver.h b/web/httpserver.h index 431ddc5..2cdf858 100644 --- a/web/httpserver.h +++ b/web/httpserver.h @@ -25,7 +25,9 @@ along with this program. If not, see . #include #include +#include #include +#include class HttpServer { diff --git a/zeroconf/networkhotplugnotifier.cpp b/zeroconf/networkhotplugnotifier.cpp index 6692752..4857ec7 100644 --- a/zeroconf/networkhotplugnotifier.cpp +++ b/zeroconf/networkhotplugnotifier.cpp @@ -28,7 +28,7 @@ along with this program. If not, see . #include #if __FreeBSD__ #include -#include +#include #else #include #include @@ -36,6 +36,8 @@ along with this program. If not, see . #include #endif // !__APPLE__ +#include + struct NetworkHotplugNotifier::Private { std::thread mThread; @@ -48,7 +50,8 @@ struct NetworkHotplugNotifier::Private #if !__APPLE__ int fds[2]; if (::pipe(fds) < 0) { - std::cerr << "Could not create socket pair " << errno << std::endl; + std::cerr << "Could not create socket pair " + << ::strerror(errno) << std::endl; return; } mPipeReadFd = fds[0]; @@ -73,7 +76,8 @@ struct NetworkHotplugNotifier::Private #if !__APPLE__ int sock = ::socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock < 0) { - std::cerr << "Could not create netlink socket: " << errno << std::endl; + std::cerr << "Could not create netlink socket: " + << ::strerror(errno) << std::endl; return; }