From b261401c72ff066462a6bc042b0f349382a9971a Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Thu, 14 Jan 2016 20:46:34 +0100 Subject: Fix build on *BSD --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cbc04c..1be90f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,14 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC) set (CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -Wno-unused-function") endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC) +if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") + include_directories (/usr/local/include) + link_directories (/usr/local/lib) + # Need this for SIGWINCH in FreeBSD and OpenBSD respectively; + # our POSIX version macros make it undefined + add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1) +endif ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") + # Build options option (USE_SYSTEM_TERMO "Don't compile our own termo, use the system one" OFF) @@ -45,6 +53,14 @@ set (project_libraries ${LIBEV_LIBRARIES} ${Termo_LIBRARIES} include_directories (${LIBEV_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS} ${NCURSESW_INCLUDE_DIRS}) +# -liconv may or may not be a part of libc +foreach (extra iconv) + find_library (extra_lib_${extra} ${extra}) + if (extra_lib_${extra}) + list (APPEND project_libraries ${extra}) + endif (extra_lib_${extra}) +endforeach (extra) + # Configuration include (CheckFunctionExists) set (CMAKE_REQUIRED_LIBRARIES ${project_libraries}) -- cgit v1.2.3-70-g09d2