From 35eed0b1a416d8d83706f0487527c02fbfa39069 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Mon, 29 Aug 2016 14:24:34 +1000 Subject: [PATCH] * cmake : fixes for bsd build --- CMakeLists.txt | 7 ++++++- src/CMakeLists.txt | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e185287..eef3b7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,12 @@ endif () include(GNUInstallDirs) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") -add_definitions("-D_XOPEN_SOURCE=600") +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_definitions("-D_XOPEN_SOURCE=600") +else () + include_directories(AFTER SYSTEM "/usr/local/include") + link_directories("/usr/local/lib") +endif () if (WITH_HARDENING) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security -Werror=format-security" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c00c86..6ceda77 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,6 @@ if (WITH_CSOCKET) endif () add_executable("f2b" ${SOURCES}) -target_link_libraries(f2b "dl") install(TARGETS "f2b" RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) @@ -20,11 +19,15 @@ endif () set(SOURCES "strlcpy.c" "backend-test.c" "log.c" "config.c" "backend.c") add_executable("backend-test" ${SOURCES}) -target_link_libraries("backend-test" "dl") set(SOURCES "strlcpy.c" "filter-test.c" "log.c" "config.c" "filter.c") add_executable("filter-test" ${SOURCES}) -target_link_libraries("filter-test" "dl") + +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(f2b "dl") + target_link_libraries("backend-test" "dl") + target_link_libraries("filter-test" "dl") +endif () add_subdirectory("backends") add_subdirectory("filters")