From ac6389d5da11817dd627e1406ce0ac20770a7247 Mon Sep 17 00:00:00 2001 From: Luca D'Amico Date: Thu, 19 Oct 2023 01:27:35 +0200 Subject: [PATCH] CMake: Add Haiku (BeOS-like) support --- CMakeLists.txt | 6 ++++-- libfreshclam/CMakeLists.txt | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec8a0e947f..fc6b351631 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -610,8 +610,10 @@ foreach(_cxx1x_flag -std=c++14 -std=c++11) endif() endforeach() -# Always use '-fPIC'/'-fPIE' option. -set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# Always use '-fPIC'/'-fPIE' option if OS is not Haiku. +if(NOT HAIKU) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() # Checks for header files. include(CheckIncludeFile) diff --git a/libfreshclam/CMakeLists.txt b/libfreshclam/CMakeLists.txt index 01b456c30b..218d74c320 100644 --- a/libfreshclam/CMakeLists.txt +++ b/libfreshclam/CMakeLists.txt @@ -48,6 +48,10 @@ if(ENABLE_SHARED_LIB) resolv ${APPLE_CORE_FOUNDATION} ${APPLE_SECURITY} ) + elseif(HAIKU) + target_link_libraries( freshclam + PUBLIC + network ) elseif(UNIX) if(HAVE_RESOLV_H AND NOT C_BSD) # BSD appears to have libresolv inside libc target_link_libraries( freshclam @@ -128,6 +132,10 @@ if(ENABLE_STATIC_LIB) resolv ${APPLE_CORE_FOUNDATION} ${APPLE_SECURITY} ) + elseif(HAIKU) + target_link_libraries( freshclam_static + PUBLIC + network ) elseif(UNIX) if(HAVE_RESOLV_H AND NOT C_BSD) # BSD appears to have libresolv inside libc target_link_libraries( freshclam_static