Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GTEST_HAS_PTHREAD to GTest::* target interfaces #4107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gitplcc
Copy link

@gitplcc gitplcc commented Dec 30, 2022

Add -DGTEST_HAS_PTHREAD=0/1 compiler flag to GTest::* CMake targets as pkg-config do.

Using CMake find_package my code compiled & linked smoothly but SIGSEGV when executed. Setting macro in CMAKE_CXX_FLAGS fixed it. I noted pkg-config gtest --cflags includes this macro.

@google-cla
Copy link

google-cla bot commented Dec 30, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gitplcc gitplcc changed the title Add GTEST_HAS_PTHREAD to target interface Add GTEST_HAS_PTHREAD to GTest::* target interfaces Dec 30, 2022
@derekmauro derekmauro self-assigned this Jan 9, 2023
Copy link

@defihook defihook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WhenTheCodingCodingGIF

@tpadioleau
Copy link

Up, can this merged ? the problem is still present

Comment on lines +190 to +191
target_compile_definitions(${name} INTERFACE
$<INSTALL_INTERFACE:GTEST_HAS_PTHREAD=$<BOOL:${GTEST_HAS_PTHREAD}>>)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative implementation would be to reuse GTEST_HAS_PTHREAD_MACRO

target_compile_definitions(${name} INTERFACE $<INSTALL_INTERFACE:${GTEST_HAS_PTHREAD_MACRO}>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants