GoogleTest: Restore toleration of odd test PROPERTIES count

Prior to porting `gtest_discover_tests` to `discover_tests` it silently
tolerated an unpaired property name.  `discover_tests` does not support
that, so remove the unpaired argument.  Also add a warning to help
projects avoid such usage.

Fixes: #28004
This commit is contained in:
Daniel Pfeifer
2026-07-30 12:23:22 -04:00
committed by Brad King
parent 6147180017
commit 1b2f3287f7
+8
View File
@@ -586,6 +586,14 @@ function(gtest_discover_tests target)
endif()
set(arg_DISCOVERY_MODE ${CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE})
endif()
if(arg_PROPERTIES)
list(LENGTH arg_PROPERTIES _len_PROPERTIES)
math(EXPR _odd_PROPERTIES "${_len_PROPERTIES} % 2")
if(_odd_PROPERTIES)
list(POP_BACK arg_PROPERTIES _back_PROPERTY)
message(AUTHOR_WARNING "PROPERTIES should be key-value pairs. Ignoring unpaired key '${_back_PROPERTY}'.")
endif()
endif()
get_property(test_launcher
TARGET ${target}