diff options
author | Janne Blomqvist <janne.blomqvist@aalto.fi> | 2017-09-13 17:43:12 +0300 |
---|---|---|
committer | Janne Blomqvist <janne.blomqvist@aalto.fi> | 2017-09-13 17:43:12 +0300 |
commit | f739af1e43e0005971641738f588f28c9abae08d (patch) | |
tree | f0ea0f6a8456e270ff90b7a3daa086fe31690d9a /CMakeLists.txt | |
parent | 205df66325b566d2ae5f87f8a68f9d829765d4d5 (diff) |
Simplify pthreads library detection
Use the cmake builtin Threads library detection, and bail out if it
wasn't pthreads. This allows deleting the cmake/FindPTHREAD.cmake file
which complains because pthreads doesn't provide a pkg-config file.
In newer versions of cmake the FindThreads module has the
THREADS_PREFER_PTHREAD_FLAG variable and creates a Threads::Threads
import target. However, in order top remain compatible with older
cmake version this is not used.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4661256cf..0e8d26bf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,13 @@ add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") find_required_package(GTK) -find_required_package(PTHREAD) + +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads REQUIRED) +if(NOT CMAKE_USE_PTHREADS_INIT) + message(FATAL_ERROR "pthreads thread library not found") +endif() + find_suggested_package(GCRYPT) find_suggested_package(AVAHI) |