Google Test and Google Mock require matching versions to work,
so this requirement should be described in the pkgconfig files.
This change is derived from the one used for the Fedora gtest package.
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Remove the threads link library variable references from the pkg-config
Cflags: field, removing -lpthread(s) from the compile flags.
"-l*" linker flags should only be part of the Libs: section and should
not be part of the Cflags: section in pkg-config files.
This was first suggested in
https://github.com/google/googletest/pull/2006 and further discussed in
https://github.com/google/googletest/pull/2483 .
The change makes implicit assumptions on the layout of the install
tree, which is going to break in many ways.
The correct solution is to use the `PKG_CONFIG_SYSROOT_DIR` variable
to inject the cross-compiled sysroot into `-I` and `-L` paths.
Using absolute paths in the pkg-config file makes it not relocatable and
leads to problems, when trying to use it with precompiled cross
toolchains. Setting prefix to relative path based on pcfiledir makes it
more reliable for such cases.