aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-01 19:15:18 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-03 23:35:21 +0100
commitb5724a654a4aadeabcfa3de3847768239931c687 (patch)
treef59b4340d6af01b41d589af4ff6fd44bd1784001 /CMakeLists.txt
parent66340e08d7388a65102710d71ce4ad13bbbe7467 (diff)
downloadliberty-b5724a654a4aadeabcfa3de3847768239931c687.tar.gz
liberty-b5724a654a4aadeabcfa3de3847768239931c687.tar.xz
liberty-b5724a654a4aadeabcfa3de3847768239931c687.zip
Compile tests with pthreads support
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 5 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12843d8..f430c2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,9 +11,11 @@ endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
find_package (PkgConfig REQUIRED)
pkg_check_modules (libssl REQUIRED libssl libcrypto)
-# -lpthread is only there for debugging (gdb & errno)
+set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+include (AddThreads)
+
# -lrt is only for glibc < 2.17
-set (common_libraries ${libssl_LIBRARIES} rt pthread)
+set (common_libraries ${libssl_LIBRARIES} rt)
include_directories (${libssl_INCLUDE_DIRS})
link_directories (${libssl_LIBRARY_DIRS})
@@ -29,6 +31,7 @@ set (common_sources ${PROJECT_BINARY_DIR}/liberty-config.h)
enable_testing ()
foreach (name liberty proto)
add_executable (test-${name} tests/${name}.c ${common_sources})
+ add_threads (test-${name})
target_link_libraries (test-${name} ${common_libraries})
add_test (NAME test-${name} COMMAND test-${name})
endforeach (name)