aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-04 00:47:12 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-04 00:47:12 +0100
commit6a19b515166f88c6909cac99e67a2a62239e4395 (patch)
tree5a377e3a1c31a092b1a088e75167fd54034a51bd /CMakeLists.txt
parent3f20b39b718d0ca0e369846cb5bc66b571785098 (diff)
downloadliberty-6a19b515166f88c6909cac99e67a2a62239e4395.tar.gz
liberty-6a19b515166f88c6909cac99e67a2a62239e4395.tar.xz
liberty-6a19b515166f88c6909cac99e67a2a62239e4395.zip
Fix build of tests under BSD
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 19 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f430c2e..4635d28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,17 +8,32 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
# Dependencies
+set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+include (AddThreads)
+
find_package (PkgConfig REQUIRED)
pkg_check_modules (libssl REQUIRED libssl libcrypto)
-set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
-include (AddThreads)
+if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
+ include_directories (/usr/local/include)
+ link_directories (/usr/local/lib)
+ # Our POSIX version macros make these undefined
+ add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
+endif ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
-# -lrt is only for glibc < 2.17
-set (common_libraries ${libssl_LIBRARIES} rt)
+set (common_libraries ${libssl_LIBRARIES})
include_directories (${libssl_INCLUDE_DIRS})
link_directories (${libssl_LIBRARY_DIRS})
+# -lrt is only for glibc < 2.17
+# -liconv may or may not be a part of libc
+foreach (extra iconv rt)
+ find_library (extra_lib_${extra} ${extra})
+ if (extra_lib_${extra})
+ list (APPEND common_libraries ${extra})
+ endif (extra_lib_${extra})
+endforeach (extra)
+
# Generate a configuration file
# TODO: actualy use the configuration file for something; so far we allow
# for direct inclusion without running this CMakeLists.txt