From f5659a122d47468cc6d2e903ea1280a75571b6c3 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 13 Apr 2022 14:30:54 +0200 Subject: [PATCH] cmake: Fix build without thread support Only check for pthread.h if threads are enabled. Fixes #367. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cd2db91..12dd86b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,7 +179,6 @@ else() check_include_files(netdb.h HAVE_NETDB_H) check_include_files(netinet/in.h HAVE_NETINET_IN_H) check_include_files(poll.h HAVE_POLL_H) - check_include_files(pthread.h HAVE_PTHREAD_H) check_function_exists(putenv HAVE_PUTENV) check_function_exists(rand_r HAVE_RAND_R) check_include_files(resolv.h HAVE_RESOLV_H) @@ -375,6 +374,8 @@ if(LIBXML2_WITH_THREADS) target_compile_definitions(LibXml2 PRIVATE _REENTRANT) if(WIN32) target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS) + else() + check_include_files(pthread.h HAVE_PTHREAD_H) endif() endif()