summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPaul Osborne <paul.osborne@smartthings.com>2020-06-18 15:47:14 +0000
committerPaul Osborne <paul.osborne@smartthings.com>2020-06-18 15:47:14 +0000
commit26d5ff457c9e6cf9b84ec9d8fb83d87caf083d96 (patch)
treebd41be9c847896c22fcacb15da998e52c7ac4144 /CMakeLists.txt
parentefbe563b4e247c6a39c0373f066bad3ec585d936 (diff)
downloadlibevent-26d5ff457c9e6cf9b84ec9d8fb83d87caf083d96.tar.gz
cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT
In some CMake integrations, portions of the toolchain may end up defining CMAKE_USE_PTHREADS_INIT even when EVENT__DISABLE_THREAD_SUPPORT is set for libevent. Modify the build to not rely on this side effect of find_package(Threads, ...) [which could be done elsewhere] but instead to use EVENT__HAVE_PTHREADS which is defined only on the desired codepath. Without this change, affected builds fail as a result of event_pthreads source files being built but with build defines which cause the build to fail. Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b064944..a76c714f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -972,7 +972,7 @@ if (NOT EVENT__DISABLE_OPENSSL)
SOURCES ${SRC_OPENSSL})
endif()
-if (CMAKE_USE_PTHREADS_INIT)
+if (EVENT__HAVE_PTHREADS)
set(SRC_PTHREADS evthread_pthread.c)
add_event_library(event_pthreads
INNER_LIBRARIES event_core
@@ -1148,7 +1148,7 @@ if (NOT EVENT__DISABLE_TESTS)
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()
- elseif (CMAKE_USE_PTHREADS_INIT)
+ elseif (EVENT__HAVE_PTHREADS)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()