aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-14 20:46:34 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-14 21:03:22 +0100
commitb261401c72ff066462a6bc042b0f349382a9971a (patch)
tree36048bd68abba6e0afdb7d62d983849a49f3231c
parentae4c89e5a7876cc3d348e6411fc42b99f8c06fd0 (diff)
downloadneetdraw-b261401c72ff066462a6bc042b0f349382a9971a.tar.gz
neetdraw-b261401c72ff066462a6bc042b0f349382a9971a.tar.xz
neetdraw-b261401c72ff066462a6bc042b0f349382a9971a.zip
Fix build on *BSD
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
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})