fix: threads are always enabled (#1036)
This commit is contained in:
parent
6d23649fef
commit
fe46778bd3
@ -39,13 +39,12 @@ option (WITH_GFLAGS "Use gflags" ON)
|
|||||||
option (WITH_GTEST "Use Google Test" ON)
|
option (WITH_GTEST "Use Google Test" ON)
|
||||||
option (WITH_PKGCONFIG "Enable pkg-config support" OFF)
|
option (WITH_PKGCONFIG "Enable pkg-config support" OFF)
|
||||||
option (WITH_SYMBOLIZE "Enable symbolize module" ON)
|
option (WITH_SYMBOLIZE "Enable symbolize module" ON)
|
||||||
option (WITH_THREADS "Enable multithreading support" ON)
|
option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON)
|
||||||
|
|
||||||
set (WITH_UNWIND libunwind CACHE STRING "unwind driver")
|
set (WITH_UNWIND libunwind CACHE STRING "unwind driver")
|
||||||
set_property (CACHE WITH_UNWIND PROPERTY STRINGS none unwind libunwind)
|
set_property (CACHE WITH_UNWIND PROPERTY STRINGS none unwind libunwind)
|
||||||
|
|
||||||
cmake_dependent_option (WITH_GMOCK "Use Google Mock" ON WITH_GTEST OFF)
|
cmake_dependent_option (WITH_GMOCK "Use Google Mock" ON WITH_GTEST OFF)
|
||||||
cmake_dependent_option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON WITH_THREADS OFF)
|
|
||||||
|
|
||||||
set (WITH_FUZZING none CACHE STRING "Fuzzing engine")
|
set (WITH_FUZZING none CACHE STRING "Fuzzing engine")
|
||||||
set_property (CACHE WITH_FUZZING PROPERTY STRINGS none libfuzzer ossfuzz)
|
set_property (CACHE WITH_FUZZING PROPERTY STRINGS none libfuzzer ossfuzz)
|
||||||
@ -58,10 +57,6 @@ if (NOT WITH_GTEST)
|
|||||||
set (CMAKE_DISABLE_FIND_PACKAGE_GTest ON)
|
set (CMAKE_DISABLE_FIND_PACKAGE_GTest ON)
|
||||||
endif (NOT WITH_GTEST)
|
endif (NOT WITH_GTEST)
|
||||||
|
|
||||||
if (NOT WITH_THREADS)
|
|
||||||
set (CMAKE_DISABLE_FIND_PACKAGE_Threads ON)
|
|
||||||
endif (NOT WITH_THREADS)
|
|
||||||
|
|
||||||
set (CMAKE_C_VISIBILITY_PRESET hidden)
|
set (CMAKE_C_VISIBILITY_PRESET hidden)
|
||||||
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
|
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||||
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
@ -88,7 +83,7 @@ if (WITH_GFLAGS)
|
|||||||
endif (gflags_FOUND)
|
endif (gflags_FOUND)
|
||||||
endif (WITH_GFLAGS)
|
endif (WITH_GFLAGS)
|
||||||
|
|
||||||
find_package (Threads)
|
find_package (Threads REQUIRED)
|
||||||
find_package (Unwind)
|
find_package (Unwind)
|
||||||
|
|
||||||
if (Unwind_FOUND)
|
if (Unwind_FOUND)
|
||||||
@ -288,14 +283,6 @@ check_cxx_symbol_exists (localtime_r "cstdlib;ctime" HAVE_LOCALTIME_R)
|
|||||||
|
|
||||||
set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
||||||
|
|
||||||
if (WITH_THREADS AND Threads_FOUND)
|
|
||||||
if (CMAKE_USE_PTHREADS_INIT)
|
|
||||||
set (HAVE_PTHREAD 1)
|
|
||||||
endif (CMAKE_USE_PTHREADS_INIT)
|
|
||||||
else (WITH_THREADS AND Threads_FOUND)
|
|
||||||
set (NO_THREADS 1)
|
|
||||||
endif (WITH_THREADS AND Threads_FOUND)
|
|
||||||
|
|
||||||
# fopen/open on Cygwin can not handle unix-type paths like /home/....
|
# fopen/open on Cygwin can not handle unix-type paths like /home/....
|
||||||
# therefore we translate TEST_SRC_DIR to windows-path.
|
# therefore we translate TEST_SRC_DIR to windows-path.
|
||||||
if (CYGWIN)
|
if (CYGWIN)
|
||||||
@ -434,15 +421,11 @@ if (HAVE_DBGHELP)
|
|||||||
set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp")
|
set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp")
|
||||||
endif (HAVE_DBGHELP)
|
endif (HAVE_DBGHELP)
|
||||||
|
|
||||||
if (HAVE_PTHREAD)
|
target_link_libraries (glog PRIVATE Threads::Threads)
|
||||||
target_link_libraries (glog PRIVATE Threads::Threads)
|
|
||||||
|
|
||||||
set (Threads_DEPENDENCY "find_dependency (Threads)")
|
if (CMAKE_THREAD_LIBS_INIT)
|
||||||
|
|
||||||
if (CMAKE_THREAD_LIBS_INIT)
|
|
||||||
set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT}")
|
set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT}")
|
||||||
endif (CMAKE_THREAD_LIBS_INIT)
|
endif (CMAKE_THREAD_LIBS_INIT)
|
||||||
endif (HAVE_PTHREAD)
|
|
||||||
|
|
||||||
if (gflags_FOUND)
|
if (gflags_FOUND)
|
||||||
# Prefer the gflags target that uses double colon convention
|
# Prefer the gflags target that uses double colon convention
|
||||||
|
|||||||
@ -7,8 +7,9 @@ endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)
|
|||||||
include (CMakeFindDependencyMacro)
|
include (CMakeFindDependencyMacro)
|
||||||
include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)
|
include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)
|
||||||
|
|
||||||
|
find_dependency (Threads)
|
||||||
|
|
||||||
@gflags_DEPENDENCY@
|
@gflags_DEPENDENCY@
|
||||||
@Threads_DEPENDENCY@
|
|
||||||
@Unwind_DEPENDENCY@
|
@Unwind_DEPENDENCY@
|
||||||
|
|
||||||
include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake)
|
include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake)
|
||||||
|
|||||||
@ -28,9 +28,6 @@
|
|||||||
/* define if you have dbghelp library */
|
/* define if you have dbghelp library */
|
||||||
#cmakedefine HAVE_DBGHELP
|
#cmakedefine HAVE_DBGHELP
|
||||||
|
|
||||||
/* define to disable multithreading support. */
|
|
||||||
#cmakedefine NO_THREADS
|
|
||||||
|
|
||||||
/* Define if you have the 'pread' function */
|
/* Define if you have the 'pread' function */
|
||||||
#cmakedefine HAVE_PREAD
|
#cmakedefine HAVE_PREAD
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user