As I’m implementing this, it is feeling more like we should remove the DISCOVERY_MODE
option and the CMAKE_GTEST_DISCOVER_TEST_DISCOVERY_MODE
variable and instead use a policy. But unlike the usual practice for policies, we would be looking to make this policy default to NEW
unilaterally and only use the OLD
behavior if CMAKE_POLICY_DEFAULT_CMPxxxx
told us to. That would be using existing mechanisms and avoids introducing a new keyword and new variable that no-one should really be using anyway. The CMAKE_POLICY_DEFAULT_CMPxxxx
variable already exists and seems well-suited to the sort of last-ditch workaround/override that we are looking for here. Thoughts?