]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: link Threads::Threads instead of CMAKE_THREAD_LIBS_INIT 43167/head
authorKen Dreyer <kdreyer@redhat.com>
Fri, 20 Aug 2021 14:44:39 +0000 (10:44 -0400)
committerKen Dreyer <kdreyer@redhat.com>
Tue, 14 Sep 2021 18:44:25 +0000 (14:44 -0400)
CMAKE_THREAD_LIBS_INIT can be empty. On newer platforms, this leads to
an error:

  CMake Error at cmake/modules/Buildpmem.cmake:47 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

This is because glibc 2.34 merged libpthread.so into libc.so.
Fedora 35 and RHEL 9 have glibc 2.34.

Fixes: https://tracker.ceph.com/issues/52353
Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
Co-authored-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6c4f31eccfd1233e4413132b11e6424e6f4e5990)

cmake/modules/Buildpmem.cmake

index 2439ac0fd2d3f90121caedbf0af73f68f6e0e018..73ddc4eb3385935b7ce7f597fde1b3ac343e5425 100644 (file)
@@ -33,10 +33,11 @@ function(build_pmem)
   add_library(pmem::pmem STATIC IMPORTED)
   add_dependencies(pmem::pmem pmdk_ext)
   file(MAKE_DIRECTORY ${PMDK_INCLUDE})
+  find_package(Threads)
   set_target_properties(pmem::pmem PROPERTIES
     INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
     IMPORTED_LOCATION "${PMDK_LIB}/libpmem.a"
-    INTERFACE_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+    INTERFACE_LINK_LIBRARIES Threads::Threads)
 
   # libpmemobj
   add_library(pmem::pmemobj STATIC IMPORTED)