Add dl library dependency

This commit is contained in:
Ivan Lezhankin 2020-03-31 21:58:00 +03:00
parent 9a7d1cd360
commit 26e81a2bbf

View File

@ -74,13 +74,15 @@ if (ENABLE_JEMALLOC)
find_library(LIBRARY_JEMALLOC jemalloc) find_library(LIBRARY_JEMALLOC jemalloc)
find_path(INCLUDE_JEMALLOC jemalloc/jemalloc.h) find_path(INCLUDE_JEMALLOC jemalloc/jemalloc.h)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_library (jemalloc STATIC IMPORTED) add_library (jemalloc STATIC IMPORTED)
set_property (TARGET jemalloc PROPERTY IMPORTED_LOCATION ${LIBRARY_JEMALLOC}) set_property (TARGET jemalloc PROPERTY IMPORTED_LOCATION ${LIBRARY_JEMALLOC})
set_property (TARGET jemalloc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_JEMALLOC}) set_property (TARGET jemalloc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_JEMALLOC})
set_property (TARGET jemalloc PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads dl)
set(THREADS_PREFER_PTHREAD_FLAG ON) set (CMAKE_REQUIRED_LIBRARIES jemalloc)
find_package(Threads REQUIRED)
set (CMAKE_REQUIRED_LIBRARIES jemalloc Threads::Threads)
check_cxx_source_compiles ( check_cxx_source_compiles (
" "
#include <jemalloc/jemalloc.h> #include <jemalloc/jemalloc.h>