From 1dffb4eb291509b9bf473fddcce3551cf28396ff Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Fri, 6 Oct 2023 22:30:31 +0200 Subject: [PATCH] fix: enable building without threads (#964) --- CMakeLists.txt | 5 +---- src/googletest.h | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5c1e5535..ac7c1734f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -468,6 +468,7 @@ set (GLOG_SRCS src/demangle.h src/logging.cc src/raw_logging.cc + src/signalhandler.cc src/symbolize.cc src/symbolize.h src/utilities.cc @@ -475,10 +476,6 @@ set (GLOG_SRCS src/vlog_is_on.cc ) -if (HAVE_PTHREAD OR WIN32 OR CYGWIN) - list (APPEND GLOG_SRCS src/signalhandler.cc) -endif (HAVE_PTHREAD OR WIN32 OR CYGWIN) - if (CYGWIN OR WIN32) list (APPEND GLOG_SRCS src/windows/port.cc diff --git a/src/googletest.h b/src/googletest.h index 9e2e9e573..0f9609968 100644 --- a/src/googletest.h +++ b/src/googletest.h @@ -595,7 +595,8 @@ class Thread { void Start() { pthread_create(&th_, nullptr, &Thread::InvokeThread, this); } void Join() { pthread_join(th_, nullptr); } #else -# error No thread implementation. + void Start() {} + void Join() {} #endif protected: @@ -614,7 +615,7 @@ class Thread { } HANDLE handle_; DWORD th_; -#else +#elif defined(HAVE_PTHREAD) pthread_t th_; #endif };