summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Bauer <sheepmaster@gmail.com>2017-09-06 10:25:46 (GMT)
committerGitHub <noreply@github.com>2017-09-06 10:25:46 (GMT)
commita92c362cfbc681c5940594c334479d1471107524 (patch)
treec8488450f7ecc971e3debe9c6e7e87f198733e06
parent86e5f0083e5217e37eb94a391a2f7349bcef4660 (diff)
parent857ddeadebe4aa75efcee728651d0947a5a1065a (diff)
downloadgoogletest-a92c362cfbc681c5940594c334479d1471107524.zip
googletest-a92c362cfbc681c5940594c334479d1471107524.tar.gz
googletest-a92c362cfbc681c5940594c334479d1471107524.tar.bz2
Merge branch 'master' into 2017_09_04_parametrizedrefs/pull/1245/head
-rw-r--r--googlemock/CMakeLists.txt2
-rw-r--r--googletest/cmake/internal_utils.cmake9
2 files changed, 8 insertions, 3 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index bd759df..724fdd5 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()
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index ec5d08c..ce94733 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -48,10 +48,14 @@ endmacro()
macro(config_compiler_and_linker)
# Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives
+ 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 ON)
find_package(Threads)
+ if (CMAKE_USE_PTHREADS_INIT)
+ set(GTEST_HAS_PTHREAD ON)
+ endif()
endif()
fix_default_compiler_settings_()
@@ -126,7 +130,8 @@ macro(config_compiler_and_linker)
set(cxx_no_rtti_flags "")
endif()
- if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available and allowed.
+ # The pthreads library is available and allowed?
+ if (DEFINED GTEST_HAS_PTHREAD)
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1")
else()
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0")
@@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags)
PROPERTIES
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
endif()
- if (CMAKE_USE_PTHREADS_INIT)
+ if (DEFINED GTEST_HAS_PTHREAD)
target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
endif()
endfunction()