diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2c094..56e3302 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ else() endif() include(CheckIncludeFile) +include(CheckLibraryExists) # Options @@ -93,6 +94,14 @@ endif() include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/wsrep-API") +# Find libraries. +CHECK_LIBRARY_EXISTS(dl dlopen "" WSREP_LIB_HAVE_LIBDL) +if (WSREP_LIB_HAVE_LIBDL) + set(WSREP_LIB_LIBDL "dl") +else() + set(WSREP_LIB_LIBDL "") +endif() + if (WSREP_LIB_WITH_UNIT_TESTS) find_package(Boost 1.54.0 REQUIRED unit_test_framework diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e3dc37..1a49f95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,4 +19,4 @@ add_library(wsrep-lib transaction.cpp uuid.cpp wsrep_provider_v26.cpp) -target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl) +target_link_libraries(wsrep-lib wsrep_api_v26 pthread ${WSREP_LIB_LIBDL})