From 5049fd0fbf2fe2e54d86d9d0f704d5daa301f819 Mon Sep 17 00:00:00 2001 From: linnemannr Date: Sun, 24 May 2015 20:07:31 -0600 Subject: Support building on FreeBSD SetFlags.cmake Add -lexecinfo to linker flags for FreeBSD to resolve backtrace() lib/sqlite/CMakeLists.txt Define _XOPEN_SOURCE to 600 instead of __POSIX_VISIBLE to 200112 for POSIX 1-2001 support. For POSIX standards, the _XOPEN_SOURCE define controls the eventual value of __POSIX_VISIBLE. _XOPEN_SOURCE is defined to 500 in sqlite.c if not already defined, which sets up _POSIX_C_SOURCE and __POSIX_VISIBLE to the 199506 for POSIX.1c lib/tolua++/CMakeLists.txt src/CMakeLists.txt Add /usr/local/lib to the library search path for FreeBSD builds src/OSSupport/Errors.cpp Correct the strerror_r() implementation determination to check whether _GNU_SOURCE is defined, not what it evaluates to --- src/CMakeLists.txt | 5 +++++ src/OSSupport/Errors.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 25de24c91..1b721100d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/OSSupport/Errors.cpp b/src/OSSupport/Errors.cpp index a5361e1a6..407799495 100644 --- a/src/OSSupport/Errors.cpp +++ b/src/OSSupport/Errors.cpp @@ -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) -- cgit v1.2.3