cmake: attempt to fix gh-actions not declaring HAVE_PTHREAD_H 126/head
authorMichael Wallner <mike@php.net>
Tue, 9 Aug 2022 08:47:44 +0000 (10:47 +0200)
committerMichael Wallner <mike@php.net>
Tue, 9 Aug 2022 08:47:44 +0000 (10:47 +0200)
CMake/CheckThreads.cmake

index ab746248be3130481c05ec54ff3217545a629dc0..e4f53c2b8f83ed5dc680bd15bf543a3928a04e67 100644 (file)
@@ -1,5 +1,9 @@
-configure_define(HAVE_PTHREAD_H)
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 set(CMAKE_THREAD_PREFER_PTHREAD ON)
 find_package(Threads)
-set(HAVE_PTHREAD_H ${CMAKE_HAVE_PTHREAD_H} CACHE INTERNAL "FindThreads found pthread.h")
+if(CMAKE_HAVE_PTHREAD_H)
+    configure_define(HAVE_PTHREAD_H)
+    set(HAVE_PTHREAD_H ${CMAKE_HAVE_PTHREAD_H} CACHE INTERNAL "FindThreads found pthread.h")
+elseif(CMAKE_USE_PTHREADS_INIT)
+    check_cxx_include(pthread.h)
+endif()