1
0

Merge pull request #2135 from linnemannr/master

Support building on FreeBSD
This commit is contained in:
Alexander Harkness 2015-05-25 07:07:18 +01:00
commit 150024265e
5 changed files with 16 additions and 2 deletions

View File

@ -240,6 +240,11 @@ macro(set_exe_flags)
# we support non-IEEE 754 fpus so can make no guarentees about error
add_flags_cxx("-ffast-math")
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
# backtrace() and friends are in libexecinfo
add_flags_lnk("-lexecinfo")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
get_clang_version()
if ("${CLANG_VERSION}" VERSION_LESS 3.0)

View File

@ -25,7 +25,7 @@ endif()
# FreeBSD requires us to define this to get POSIX 2001 standard
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_flags_cxx(-D__POSIX_VISIBLE=200112)
add_flags_cxx("-D_XOPEN_SOURCE=600")
endif()
add_library(sqlite ${SOURCE})

View File

@ -53,4 +53,8 @@ if(UNIX)
target_link_libraries(tolua m ${DYNAMIC_LOADER})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_flags_lnk(-L/usr/local/lib)
endif()
target_link_libraries(tolua tolualib lua)

View File

@ -332,4 +332,9 @@ endif ()
if (WIN32)
target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_flags_lnk(-L/usr/local/lib)
endif()
target_link_libraries(${EXECUTABLE} luaexpat jsoncpp mbedtls zlib sqlite lua SQLiteCpp event_core event_extra)

View File

@ -22,7 +22,7 @@ AString GetOSErrorString( int a_ErrNo)
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
#if !defined(__APPLE__) && ( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
#if !defined(__APPLE__) && defined( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
if (res != nullptr)