]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix building on HP-UX 11.11 PA-RISC 3862/head
authorLike Ma <likemartinma@gmail.com>
Sat, 13 Jan 2024 07:21:50 +0000 (15:21 +0800)
committerLike Ma <likemartinma@gmail.com>
Sat, 13 Jan 2024 16:32:19 +0000 (00:32 +0800)
By CMake 3.8.2 and GCC 4.7.1

build/cmake/CMakeLists.txt

index 023b998f556adc13e123c4e4e0f49db6ddcbb837..32f5fd6efb3d2686e558952721be737e58e49dea 100644 (file)
@@ -115,9 +115,20 @@ endif ()
 # External dependencies
 #-----------------------------------------------------------------------------
 if (ZSTD_MULTITHREAD_SUPPORT AND UNIX)
-    set(THREADS_PREFER_PTHREAD_FLAG ON)
-    find_package(Threads REQUIRED)
-    if(CMAKE_USE_PTHREADS_INIT)
+    if (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+        find_package(Threads)
+        if (NOT Threads_FOUND)
+            set(CMAKE_USE_PTHREADS_INIT 1)
+            set(CMAKE_THREAD_LIBS_INIT -lpthread)
+            set(CMAKE_HAVE_THREADS_LIBRARY 1)
+            set(Threads_FOUND TRUE)
+        endif ()
+    else ()
+        set(THREADS_PREFER_PTHREAD_FLAG ON)
+        find_package(Threads REQUIRED)
+    endif ()
+
+    if (CMAKE_USE_PTHREADS_INIT)
         set(THREADS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
     else()
         message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")