Merge pull request #5036 from Tachi107:cmake-pthread-flag

PiperOrigin-RevId: 952246866
Change-Id: Idccc63f83a51d6c143966d45fa197677ea58ca16
This commit is contained in:
Copybara-Service 2026-07-22 11:49:28 -07:00
commit 08da6214b8

View File

@ -63,6 +63,7 @@ macro(config_compiler_and_linker)
unset(GTEST_HAS_PTHREAD)
if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
if (CMAKE_USE_PTHREADS_INIT)
set(GTEST_HAS_PTHREAD ON)