Fix build with CMAke >= 3.24

CMake 3.24 removed CMAKE_HAVE_PTHREAD_H variable
Resolves: RHEL-183533
This commit is contained in:
Tomas Korbar 2026-07-13 08:47:40 +02:00
parent 36f3f1ae73
commit 2c0deb026a
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 643ac7a069265b26b0ba6ab0c11caa8b8d3a9977 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Tue, 9 Aug 2022 10:47:44 +0200
Subject: [PATCH] cmake: attempt to fix gh-actions not declaring HAVE_PTHREAD_H
---
CMake/CheckThreads.cmake | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/CMake/CheckThreads.cmake b/CMake/CheckThreads.cmake
index ab746248b..e4f53c2b8 100644
--- a/CMake/CheckThreads.cmake
+++ b/CMake/CheckThreads.cmake
@@ -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()

View File

@ -24,7 +24,7 @@
Name: %{libname}-awesome
Summary: Client library and command line tools for memcached server
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
Release: 12%{?dist}
Release: 13%{?dist}
License: BSD
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
@ -38,6 +38,8 @@ Patch5: %{name}-udp-test.patch
# rhbz#1995795
Patch6: %{name}-aes2.patch
Patch7: %{name}-rpath.patch
# https://github.com/awesomized/libmemcached/commit/643ac7a069265b26b0ba6ab0c11caa8b8d3a9977
Patch8: %{name}-pthread.patch
BuildRequires: cmake >= 3.9
BuildRequires: gcc
@ -122,6 +124,7 @@ memtouch Touches a key
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
# drop test hanging in mock
# and requiring some memcached build options
@ -203,6 +206,11 @@ rm -r %{buildroot}%{_datadir}/doc/%{name}/
%changelog
* Mon Jul 13 2026 Tomas Korbar <tkorbar@redhat.com> - 1.1.0-13
- Fix build with CMAke >= 3.24
- CMake 3.24 removed CMAKE_HAVE_PTHREAD_H variable
- Resolves: RHEL-183533
* Fri Nov 12 2021 Tomas Korbar <tkorbar@redhat.com> - 1.1.0-12
- Fix rpath
- Related: rhbz#1995795