aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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