This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Make gtest macro definitions a part the library interface
ClosedPublic

Authored by labath on Jul 28 2020, 6:41 AM.

Details

Summary

These definitions are needed by any file which uses gtest. Previously we
were adding them in the add_unittest function, but over time we've
accumulated libraries (which don't go through add_unittest) building on
gtest and this has resulted in proliferation of the definitions.

Making this a part of the library interface enables them to be managed
centrally. This follows a patch for -Wno-suggest-override (D84554) which
took a similar approach.

Diff Detail

Event Timeline

labath created this revision.Jul 28 2020, 6:41 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 28 2020, 6:41 AM
labath requested review of this revision.Jul 28 2020, 6:41 AM
ldionne accepted this revision.Jul 28 2020, 7:59 AM

Can you confirm that all the targets that need to "link" (in the CMake sense) against gtest use the gtest CMake target?

This revision is now accepted and ready to land.Jul 28 2020, 7:59 AM
This revision was landed with ongoing or failed builds.Aug 11 2020, 6:22 AM
This revision was automatically updated to reflect the committed changes.

Can you confirm that all the targets that need to "link" (in the CMake sense) against gtest use the gtest CMake target?

I wouldn't use the word "confirm" but I did check that I am able to run test for subprojects I have modified (in their default configs) and that no other subprojects define these macros.