This change accomplishes the following items:
1. Make `libgtest` require pthread support.
2. Stop building static copies of the libraries.
3. Do not install `gtest-config`.
4. Build the upstream-provided tests.
=== Make `libgtest` require pthread support ===
As noted by @asomers in rS300906 (`cddl/usr.sbin/zfsd/tests/Makefile`
specifically), googletest requires libpthread in order to function, if
`-DGTEST_HAS_PTHREAD` is defined.
While this is true, the code was not being linked against libpthread,
resulting in libgtest being broken, and thus all tests reliant on the library
broken at runtime.
Long story short, the integration logic in `googletest/m4/acx_pthread.m4` is
broken. Switching to cmake unbreaks using googletest out of the box [1].
=== Stop building static copies of the libraries ===
For whatever reason, the maintainers thought it was best to build either with
shared or static libraries, but not both. Switching to cmake makes this an
either-or transition.
=== Do not install `gtest-config` ===
Using `gtest-config` when building from a GitHub clone results in incorrect
behavior, as it looks up the headers in `/usr/local/include` before the
headers in the local clone, making local builds with installed copies of
devel/googletest impossible.
PR: 236169 [1]
=== Build the upstream-provided tests ===
A number of tests are available with the gtest project. In order to do a
compare and contrast between the work I started as far as importing the
project to base, I needed to build/run them.