From 7859f8123311c1b8f69856d3c5e1b8501fbdae11 Mon Sep 17 00:00:00 2001 From: vitaut Date: Mon, 29 Jun 2015 07:34:30 -0700 Subject: [PATCH] Don't use pthreads if they are not available --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06ea1409..cb42b665 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,7 +119,11 @@ add_library(gmock STATIC gmock/gmock-gtest-all.cc gmock/gmock/gmock.h gmock/gtest/gtest.h gmock/gtest/gtest-spi.h) find_package(Threads) -target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) +if (Threads_FOUND) + target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) +else () + target_compile_definitions(gmock PUBLIC GTEST_HAS_PTHREAD=0) +endif () # Check if variadic templates are working and not affected by GCC bug 39653: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39653