diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f385bec..7e182f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,9 +157,14 @@ if (UNIX) ) else() # not-apple - - # add include dir for bsd (posix uses /usr/include/) - set (CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include") + # FreeBSD uses /usr/local for anything not part of base + # Also package avahi-libdns puts dns_sd.h a bit deeper + if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/local/include;/usr/local/include/avahi-compat-libdns_sd") + set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib") + include_directories("/usr/local/include" "/usr/local/include/avahi-compat-libdns_sd") + link_directories("/usr/local/lib") + endif() set (XKBlib "X11/Xlib.h;X11/XKBlib.h") set (CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h") @@ -174,6 +179,7 @@ if (UNIX) check_include_files ("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H) check_include_files ("${XKBlib}" HAVE_X11_XKBLIB_H) check_include_files ("X11/extensions/XInput2.h" HAVE_XI2) + check_include_files ("dns_sd.h" HAVE_DNSSD) if (HAVE_X11_EXTENSIONS_DPMS_H) # Assume that function prototypes declared, when include exists. @@ -184,6 +190,10 @@ if (UNIX) message (FATAL_ERROR "Missing header: " ${XKBlib}) endif() + if (NOT HAVE_DNSSD) + message (FATAL_ERROR "Missing header: dns_sd.h") + endif() + check_library_exists ("SM;ICE" IceConnectionNumber "" HAVE_ICE) check_library_exists ("Xext;X11" DPMSQueryExtension "" HAVE_Xext) check_library_exists ("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst) @@ -305,7 +315,14 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (OPENSSL_LIBS ssl crypto) else() - message (FATAL_ERROR "Couldn't find OpenSSL") + find_library (lib_ssl ssl) + find_library (lib_crypto crypto) + if (NOT lib_ssl) + message(FATAL_ERROR "openssl library not found") + elseif (NOT lib_crypto) + message(FATAL_ERROR "crypto library not found") + endif() + set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto}) endif() # diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 869ef47a..4a7e291a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -36,7 +36,8 @@ if (WIN32) elseif (APPLE) find_library(APPSERVICES_LIB ApplicationServices) target_link_libraries(barrier ${APPSERVICES_LIB}) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR + ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") target_link_libraries (barrier dns_sd) else() target_link_libraries (barrier) diff --git a/src/lib/arch/CMakeLists.txt b/src/lib/arch/CMakeLists.txt index 8a06b41e..113cdd99 100644 --- a/src/lib/arch/CMakeLists.txt +++ b/src/lib/arch/CMakeLists.txt @@ -40,5 +40,8 @@ endif() add_library(arch STATIC ${sources}) if (UNIX) - target_link_libraries(arch dl ${libs}) + target_link_libraries(arch ${libs}) + if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(arch dl) + endif() endif()