Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
857ddead
Commit
857ddead
authored
Sep 05, 2017
by
Gennadiy Civil
Committed by
GitHub
Sep 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #975 from LebedevRI/respect-option
CMake: use threads if allowed and found, not just if found.
parents
7c6353d2
1a62d1b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
CMakeLists.txt
googlemock/CMakeLists.txt
+1
-1
internal_utils.cmake
googletest/cmake/internal_utils.cmake
+7
-2
No files found.
googlemock/CMakeLists.txt
View file @
857ddead
...
@@ -164,7 +164,7 @@ if (gmock_build_tests)
...
@@ -164,7 +164,7 @@ if (gmock_build_tests)
cxx_test
(
gmock_link_test gmock_main test/gmock_link2_test.cc
)
cxx_test
(
gmock_link_test gmock_main test/gmock_link2_test.cc
)
cxx_test
(
gmock_test gmock_main
)
cxx_test
(
gmock_test gmock_main
)
if
(
CMAKE_USE_PTHREADS_INIT
)
if
(
DEFINED GTEST_HAS_PTHREAD
)
cxx_test
(
gmock_stress_test gmock
)
cxx_test
(
gmock_stress_test gmock
)
endif
()
endif
()
...
...
googletest/cmake/internal_utils.cmake
View file @
857ddead
...
@@ -48,10 +48,14 @@ endmacro()
...
@@ -48,10 +48,14 @@ endmacro()
macro
(
config_compiler_and_linker
)
macro
(
config_compiler_and_linker
)
# Note: pthreads on MinGW is not supported, even if available
# Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives
# instead, we use windows threading primitives
unset
(
GTEST_HAS_PTHREAD
)
if
(
NOT gtest_disable_pthreads AND NOT MINGW
)
if
(
NOT gtest_disable_pthreads AND NOT MINGW
)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
set
(
THREADS_PREFER_PTHREAD_FLAG ON
)
set
(
THREADS_PREFER_PTHREAD_FLAG ON
)
find_package
(
Threads
)
find_package
(
Threads
)
if
(
CMAKE_USE_PTHREADS_INIT
)
set
(
GTEST_HAS_PTHREAD ON
)
endif
()
endif
()
endif
()
fix_default_compiler_settings_
()
fix_default_compiler_settings_
()
...
@@ -126,7 +130,8 @@ macro(config_compiler_and_linker)
...
@@ -126,7 +130,8 @@ macro(config_compiler_and_linker)
set
(
cxx_no_rtti_flags
""
)
set
(
cxx_no_rtti_flags
""
)
endif
()
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"
)
set
(
GTEST_HAS_PTHREAD_MACRO
"-DGTEST_HAS_PTHREAD=1"
)
else
()
else
()
set
(
GTEST_HAS_PTHREAD_MACRO
"-DGTEST_HAS_PTHREAD=0"
)
set
(
GTEST_HAS_PTHREAD_MACRO
"-DGTEST_HAS_PTHREAD=0"
)
...
@@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags)
...
@@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags)
PROPERTIES
PROPERTIES
COMPILE_DEFINITIONS
"GTEST_CREATE_SHARED_LIBRARY=1"
)
COMPILE_DEFINITIONS
"GTEST_CREATE_SHARED_LIBRARY=1"
)
endif
()
endif
()
if
(
CMAKE_USE_PTHREADS_INIT
)
if
(
DEFINED GTEST_HAS_PTHREAD
)
target_link_libraries
(
${
name
}
${
CMAKE_THREAD_LIBS_INIT
}
)
target_link_libraries
(
${
name
}
${
CMAKE_THREAD_LIBS_INIT
}
)
endif
()
endif
()
endfunction
()
endfunction
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment