[libxml2] cmake: Fix build without thread support



commit f5659a122d47468cc6d2e903ea1280a75571b6c3
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Apr 13 14:30:54 2022 +0200

    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()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]