1
0

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
This commit is contained in:
linnemannr 2015-05-24 20:07:31 -06:00
parent 7e0dc0f9bc
commit 5049fd0fbf
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 # we support non-IEEE 754 fpus so can make no guarentees about error
add_flags_cxx("-ffast-math") 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") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
get_clang_version() get_clang_version()
if ("${CLANG_VERSION}" VERSION_LESS 3.0) 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 # FreeBSD requires us to define this to get POSIX 2001 standard
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_flags_cxx(-D__POSIX_VISIBLE=200112) add_flags_cxx("-D_XOPEN_SOURCE=600")
endif() endif()
add_library(sqlite ${SOURCE}) add_library(sqlite ${SOURCE})

View File

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

View File

@ -332,4 +332,9 @@ endif ()
if (WIN32) if (WIN32)
target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib) target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib)
endif() 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) 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(): // 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)); char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
if (res != nullptr) if (res != nullptr)