summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-05-28 14:43:24 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-05-28 14:43:24 +0200
commit48d46cac3f21805eedc39a53cb224735c46ab77a (patch)
tree12b3db6762269f75eeb726eec0c7f83644cf81b6
parentbf609adeeb2acf40dbbce97aab051712913b845c (diff)
downloadsocket_wrapper-48d46cac3f21805eedc39a53cb224735c46ab77a.tar.gz
socket_wrapper-48d46cac3f21805eedc39a53cb224735c46ab77a.tar.xz
socket_wrapper-48d46cac3f21805eedc39a53cb224735c46ab77a.zip
cmake: Link against libdl.
-rw-r--r--ConfigureChecks.cmake8
-rw-r--r--src/CMakeLists.txt2
2 files changed, 10 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index d68578f..6dfac8a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -132,7 +132,15 @@ int main(void) {
return 0;
}" HAVE_SOCKADDR_STORAGE)
+check_library_exists(dl dlopen "" HAVE_LIBDL)
+if (HAVE_LIBDL)
+ find_library(DLFCN_LIBRARY dl)
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${DLFCN_LIBRARY})
+endif (HAVE_LIBDL)
+
# ENDIAN
if (NOT WIN32)
test_big_endian(WORDS_BIGENDIAN)
endif (NOT WIN32)
+
+set(SWRAP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "swrap required system libraries")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 23fdf60..96b6cd1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,6 +3,8 @@ project(libsocket_wrapper C)
include_directories(${CMAKE_BINARY_DIR})
add_library(socket_wrapper SHARED socket_wrapper.c)
+target_link_libraries(socket_wrapper ${SWRAP_REQUIRED_LIBRARIES})
+
install(
TARGETS
socket_wrapper