From dddadcb93aeb50ea2f26bfb7500aa2a9f82500ed Mon Sep 17 00:00:00 2001 From: Piotrek Zadroga Date: Tue, 26 Sep 2023 12:13:20 +0200 Subject: [PATCH] [#3065] get gtest ver with pkg-config --- m4macros/ax_gtest.m4 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/m4macros/ax_gtest.m4 b/m4macros/ax_gtest.m4 index 725f6dab31..93953fa7b5 100644 --- a/m4macros/ax_gtest.m4 +++ b/m4macros/ax_gtest.m4 @@ -169,6 +169,12 @@ if test "x$enable_gtest" = "xyes" ; then GTEST_LDFLAGS="-L$dir/lib" GTEST_LDADD="-lgtest" GTEST_FOUND="true" + if test -f "$dir/lib/pkgconfig/gtest.pc" ; then + pkg-config --modversion "$dir/lib/pkgconfig/gtest.pc" &> /dev/null + if test $? -eq 0; then + GTEST_VERSION="$(pkg-config --modversion "$dir/lib/pkgconfig/gtest.pc")" + fi + fi break else AC_MSG_WARN([Found Google Test include but not the library in $dir.])