diff options
author | Herbert Thielen <thielen@hs-worms.de> | 2017-09-07 09:05:28 (GMT) |
---|---|---|
committer | Herbert Thielen <thielen@hs-worms.de> | 2017-09-07 09:05:28 (GMT) |
commit | bc60b5a82704c611abab34b3eeb496edf8521015 (patch) | |
tree | ae2100d3b8c74a585a8eae3885f5fa57ce045b84 /googletest/cmake/internal_utils.cmake | |
parent | 55fd999adf5a8ecfcd502f07b0ea4b691ca7215f (diff) | |
parent | a33b6b091999d44f771761be03beb64d3af2350a (diff) | |
download | googletest-bc60b5a82704c611abab34b3eeb496edf8521015.zip googletest-bc60b5a82704c611abab34b3eeb496edf8521015.tar.gz googletest-bc60b5a82704c611abab34b3eeb496edf8521015.tar.bz2 |
Merge branch 'master' into hethi/travis-release-build
Diffstat (limited to 'googletest/cmake/internal_utils.cmake')
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 0b41e3a..9915c11 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() |