fix FreeBSD build

This commit is contained in:
walker0643 2018-03-02 18:36:31 -05:00
parent c605cbdbcc
commit 625253a7e8
3 changed files with 27 additions and 6 deletions

View File

@ -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()
#

View File

@ -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)

View File

@ -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()