Currently, gtest-config --libs and gmock-config --libs are used to extract linker flags.
https://chromium.git.corp.google.com/chromiumos/platform2/+/a51b89fa44277358cd1d4ca4b0269e74ddb5151c/common-mk/BUILD.gn#147
However, the -config program has --ldflags. According to gtest-config:
Compilation Flag Queries:
--cppflags compile flags specific to the C-like preprocessors
--cxxflags compile flags appropriate for C++ programs
--ldflags linker flags
--libs libraries for linking
So, --ldflags should be considered.
At the moment, practically it would fail.
--ldflags returns -L/usr/lib64, which is host lib dirs.
Specifically, /usr/lib64 contains host libchrome, which is built with NDEBUG.
However, target binary is built without NDEBUG, so the inconsistency causes an link error (intentional behavior: cf) https://chromium.googlesource.com/aosp/platform/external/libchrome/+/master/base/logging.h#203 )
Currently, the problem isn't hit, because the executable is linked against target libs.
In theory, --ldflags can provide more flags than -L, it's nice to be considered.