aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/CMakeLists.txt
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2016-12-30 10:46:39 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2017-09-01 21:02:59 +0300
commit1a62d1b088062a3d1869e4cd33e99ab02f6f44e6 (patch)
treeb31f329902fc33f1849ae475a565a90cda0cf45c /googlemock/CMakeLists.txt
parente4f6c0b358a4a08ecb7adc7235ec4e07596993d3 (diff)
downloadgoogletest-1a62d1b088062a3d1869e4cd33e99ab02f6f44e6.tar.gz
googletest-1a62d1b088062a3d1869e4cd33e99ab02f6f44e6.tar.bz2
googletest-1a62d1b088062a3d1869e4cd33e99ab02f6f44e6.zip
CMake: use threads if allowed and found, not just if found.
If the user's cmakelists.txt first look for threads using find_package(Threads), then set(gtest_disable_pthreads ON), and then include googletest. GoogleTest will not look for threads. But since they have already been found before in user's cmakelists, it will use them regardless. This helped me fix build issue in darktable-org/rawspeed on windows/MSYS2, even though there are threads, and they are usable, googletest build was failing with issues about AutoHandle. I was first looking for threads, and only then including googletest, so no matter the value of gtest_disable_pthreads, it failed. The other obvious solution is for user to first include googletest, and only then look for threads by himself.
Diffstat (limited to 'googlemock/CMakeLists.txt')
-rw-r--r--googlemock/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index bd759dfd..724fdd5f 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -164,7 +164,7 @@ if (gmock_build_tests)
cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc)
cxx_test(gmock_test gmock_main)
- if (CMAKE_USE_PTHREADS_INIT)
+ if (DEFINED GTEST_HAS_PTHREAD)
cxx_test(gmock_stress_test gmock)
endif()