Re: [OE-core][dunfell 16/18] cmake: FindGTest: Add target for gmock library

Jasper Orschulko
2021-12-13T17:41:27Z

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Eero,

my first reflex was to say, that I don't believe this to be necessary.
As you already said, these variables aren't documented and thus I'd
argue that you don't have to consider them for maintaining backwards
compatibility during backports. I personally see this as a bug on our
part and as a coincidence that our setup worked pre-patch.

However, I'm not sure WHY those two variables where actually used by us
or where they originated from. Going as far back as cmake 3.0, these
variables where never documented, however doing a quick search for
those reveals that they actually are used in other (older?) projects.
So I'm not quite sure how many other users might be affected by this.
Maybe we actually SHOULD keep supporting them for the LTS branch, just
in case?

- --
With best regards

Jasper Orschulko
DevOps Engineer

Tel. +49 30 58 58 14 265
Fax +49 30 58 58 14 999
Jasper.Orschulko@iris-sensing.com

• • • • • • • • • • • • • • • • • • • • • • • • • •

iris-GmbH
infrared & intelligent sensors
Schnellerstraße 1-5 | 12439 Berlin

https://iris-sensing.com/

On Mon, 2021-12-13 at 15:03 +0200, Eero Aaltonen wrote:
> On Fri, 2021-12-10 at 18:49 +0000, Jasper Orschulko wrote:
> > Hello everyone,
> >
> > after some digging we identified the issue to be on our part.
> > We have been using "GTEST_LIBRARY" and "GTEST_MAIN_LIBRARY" in our
> > CMake scripts instead of "GTEST_LIBRARIES" and
> > "GTEST_MAIN_LIBRARIES",
> > as described in the cmake docs:
> >
> https://cmake.org/cmake/help/v3.16/module/FindGTest.html#result-variables
>
> Thank you for providing more details.
>
> The gmock target can be backported to dunfell in an alternative way,
> by
> leaving out the
>     find_package(GTest QUIET NO_MODULE)
>
> call and subsequent lines and letting the FindModule create all the
> definitions. This would leave also the undocumented variables intact,
> if that is desired.
>
> This should be as simple as dropping the lines
> ----------------------------------------------
> # first specifically look for the CMake version of GTest
> find_package(GTest QUIET NO_MODULE)
>
> # if we found the GTest cmake package then we are done, and
> # can print what we found and return.
> if(GTest_FOUND)
>     set(GTEST_FOUND ${GTest_FOUND})
>     FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest HANDLE_COMPONENTS
> CONFIG_MODE)
>
>     set(GTEST_LIBRARIES      GTest::gtest)
>     set(GTEST_MAIN_LIBRARIES GTest::gtest_main)
>
>     __gtest_define_backwards_compatible_library_targets()
>
>     return()
> endif()
> ----------------------------------------------
>
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE4WyPMIC5Ap4+Ooo1Ygqew07VMNUFAmG3hbsACgkQYgqew07V
MNW6Gwf8DcYj0KlqNSLpB3tlsplI4Wac9mfxAd/g2BoKcyekRK2IArMJKzNDEhi6
GqKar0z3QgRZQrF54X63/MnhaqIypHef+8YyUPVVYhq+HUZSXc+6c3SjIdVBBJn8
G04/pxmoLybBvqMmFcP67qhFlojo7yW2viK8stdVZ49VwfE3XIq3fSxrqE6xQq1V
nOoZw5DRLqgCGpeB41OebYXE1bOIX3WOgk5Pzkuf4Iq9bLDoWg5zXSxw0djYCMZS
2E6kHIwJavEVKhmQoC2IpiPrZ4cJQ57JZvIR95HsFkG/C/N6sKXlJu2VLId+5xdb
IwUexGr3vUCXGqrUTWOZE6kxhdo74Q==
=/Myf
-----END PGP SIGNATURE-----