FindGTest: Detect GTest first by Config
This PR changes the behavior of Modules/FindGTest.cmake
to better match upstream Google Test.
- It will try to detect GTest by Config first
- For upstream compatibility it will promote upstream names
GTest::gtest
andGTest::gtest_main
There are two potential pitfalls:
- The variable
GTEST_FOUND
is now more correctly namedGTest_FOUND
for compatibility with theNO_MODULE
detection of GTest. But this change is not backward compatible. - There is a code block that starts with comment
# Allow GTEST_LIBRARY and GTEST_MAIN_LIBRARY to be set manually
... This functionality is now only available when GTest was not found by config. I'm not sure if this is what users always expect?
Fixes: #18801 (closed)
Topic-rename: FindGTest-config-mode
Edited by Brad King