google / google/googletest

Exported CMake configuration is missing the `GTEST_HAS_PTHREAD={0,1}` compile option

Open
#3,692 4 comments 0 reactions 1 assignee Claimed by @derekmauro View on GitHub
bug
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

**Describe the bug**

Projects that do `find_package(GTest)` and `target_link_libraries( GTest::gtest)` will have the `GTEST_HAS_PTHREAD` macro set by https://github.com/google/googletest/blob/1b2606425c4040cacadaa22689423ec0a29f316d/googletest/include/gtest/internal/gtest-port.h#L544-L548 instead of honoring the configuration at the time GoogleTest was installed.

**Steps to reproduce the bug**

Whether configure with `gtest_disable_pthreads` `ON` or `OFF`, the generated `.pc` files have the `-DGTEST_HAS_PTHREAD={1,0}` compile definition but the `GTest::gtest[_main]` targets that are being installed do not.

**Does the bug persist in the most recent commit?**

Yes

**What build system are you using?**

CMake build. Bug is not sensitive to the version.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.