Skip to content

FindGTest: Detect GTest first by Config

Mario Emmenlauer requested to merge emmenlau/cmake:bda_improve_findgtest into master

This PR changes the behavior of Modules/FindGTest.cmake to better match upstream Google Test.

  1. It will try to detect GTest by Config first
  2. For upstream compatibility it will promote upstream names GTest::gtest and GTest::gtest_main

There are two potential pitfalls:

  • The variable GTEST_FOUND is now more correctly named GTest_FOUND for compatibility with the NO_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

Merge request reports