From d661513f13b529609982f23707b22dacb35d36a8 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Sun, 14 Jan 2018 22:18:44 +0300 Subject: [PATCH] mdbx-cmake: fix missing pthread. Change-Id: Ief4ad9ac5348f09ae4efd4e6a8d09c4d76c0f299 --- CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49fb625a..31d3a4ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED on) add_definitions(-DNDEBUG=1 -DMDBX_DEBUG=0 -DLIBMDBX_EXPORTS=1 -D_GNU_SOURCE=1) +find_package(Threads REQUIRED) + get_directory_property(hasParent PARENT_DIRECTORY) if(hasParent) set(STANDALONE_BUILD 0) @@ -118,12 +120,16 @@ set_target_properties(${TARGET}_STATIC PROPERTIES ) target_include_directories(${TARGET}_STATIC PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - ) - + ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${TARGET}_SHARED PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - ) + ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(${TARGET}_STATIC ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET}_SHARED ${CMAKE_THREAD_LIBS_INIT}) +if(UNIX AND NOT APPLE) + target_link_libraries(${TARGET}_STATIC rt) + target_link_libraries(${TARGET}_SHARED rt) +endif() install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx) install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)