This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Prefix gtest and gtest_main with "llvm_".
ClosedPublic

Authored by stellaraccident on Mar 1 2022, 8:40 PM.

Details

Summary

The upstream project ships CMake rules for building vanilla gtest/gmock which conflict with the names chosen by LLVM. Since LLVM's build rules here are quite specific to LLVM, prefixing them to avoid collision is the right thing (i.e. there does not appear to be a path to letting someone *replace* LLVM's googletest with one they bring, so co-existence should be the goal).

This allows LLVM to be included with testing enabled within projects that themselves have a dependency on an official gtest release.

Diff Detail

Event Timeline

stellaraccident created this revision.Mar 1 2022, 8:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 8:40 PM
Herald added a subscriber: mgorny. · View Herald Transcript
stellaraccident requested review of this revision.Mar 1 2022, 8:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 8:40 PM

Add more instances of gtest.

Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptMar 1 2022, 9:10 PM
Herald added subscribers: libc-commits, lldb-commits, Restricted Project and 2 others. · View Herald Transcript
mehdi_amini accepted this revision.Mar 2 2022, 1:31 AM
This revision is now accepted and ready to land.Mar 2 2022, 1:31 AM

Landing. Windows test failure seems unrelated with the current rebase (passed on previous).

This revision was landed with ongoing or failed builds.Mar 2 2022, 10:53 AM
This revision was automatically updated to reflect the committed changes.

Looks like there is an lldb buildbot failure: https://lab.llvm.org/buildbot/#/builders/68/builds/28116

I'm not sure why this didn't fail on presubmit. The fix should be to find the missing rename in lldb cmake files and update to llvm_gtest.

Looks like there is an lldb buildbot failure: https://lab.llvm.org/buildbot/#/builders/68/builds/28116

I'm not sure why this didn't fail on presubmit. The fix should be to find the missing rename in lldb cmake files and update to llvm_gtest.

Fix was non-obvious. Reverted in 7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2 and will followup.