Fix building on HP-UX 11.11 PA-RISC

By CMake 3.8.2 and GCC 4.7.1
This commit is contained in:
Like Ma
2024-01-14 00:32:19 +08:00
parent ffde100b68
commit e49d1ab6aa
+12 -1
View File
@@ -115,9 +115,20 @@ endif ()
# External dependencies # External dependencies
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (ZSTD_MULTITHREAD_SUPPORT AND UNIX) if (ZSTD_MULTITHREAD_SUPPORT AND UNIX)
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) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if(CMAKE_USE_PTHREADS_INIT) endif ()
if (CMAKE_USE_PTHREADS_INIT)
set(THREADS_LIBS "${CMAKE_THREAD_LIBS_INIT}") set(THREADS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
else() else()
message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")