summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAdenilson Cavalcanti <cavalcantii@chromium.org>2023-01-27 17:31:08 +0000
committerCopybara-Service <copybara-worker@google.com>2023-01-27 09:39:39 -0800
commit2d44c51ada6d325b85b53427b02dabf44648bca4 (patch)
tree278036f79e5f4c30d8503bb820107a4726668d68 /CMakeLists.txt
parent44d9b490c721abdb923d5c6c23ac211e45ffb1a5 (diff)
downloadzlib-2d44c51ada6d325b85b53427b02dabf44648bca4.tar.gz
[zlib][build] Handle CentOS quirks
Apparently some environments (e.g. CentOS) require to explicitly link with libpthread otherwise build/link of zlib works fine but zlib_bench linking fails. Bug: 1381000 Change-Id: Idfc1984dc096672255bf43f141572c222147f681 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4198473 Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org> Reviewed-by: Noel Gordon <noel@chromium.org> Reviewed-by: Hans Wennborg <hans@chromium.org> Cr-Commit-Position: refs/heads/main@{#1097968} NOKEYCHECK=True GitOrigin-RevId: 767a83e626f09cf18013e88453514c692442dceb
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7241fb3..f06e193 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,11 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
add_compile_options(-msse4.2 -mpclmul)
# Required by CPU features detection code.
add_definitions(-DX86_NOT_WINDOWS)
+ # Apparently some environments (e.g. CentOS) require to explicitly link
+ # with pthread and that is required by the CPU features detection code.
+ find_package (Threads REQUIRED)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
#