Add FreeBSD Support (#931)

This commit is contained in:
Kyle Cook 2018-03-21 16:35:10 -06:00 committed by Patrick Ziegler
parent eb9c8e66f2
commit 0f34178104
3 changed files with 18 additions and 0 deletions

View File

@ -31,8 +31,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# Need dprintf() for FreeBSD 11.1 and older
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WITH_DPRINTF")
# libinotify uses c99 extension, so suppress this error
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c99-extensions")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=parentheses-equality")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")

View File

@ -22,3 +22,8 @@ querylib(WITH_XRENDER "pkg-config" xcb-render libs dirs)
querylib(WITH_XRM "pkg-config" xcb-xrm libs dirs)
querylib(WITH_XSYNC "pkg-config" xcb-sync libs dirs)
querylib(WITH_XCURSOR "pkg-config" xcb-cursor libs dirs)
# FreeBSD Support
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
querylib(TRUE "pkg-config" libinotify libs dirs)
endif()

View File

@ -4,7 +4,11 @@
#include <alsa/asoundlib.h>
#else
#include <assert.h>
#ifndef __FreeBSD__
#include <endian.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>