Commit b5e7b22d authored by Brad King's avatar Brad King

FindGTest: Refactor test type checks to avoid cases triggering CMP0064

Update our if() conditions to avoid CMP0064 warnings when `${test_type}`
is equal to `TEST`.
Reported-by: default avatarDavid T. Chen <dchen@mail.nih.gov>
parent b4a2ada2
......@@ -124,11 +124,11 @@ function(GTEST_ADD_TESTS executable extra_args)
string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
# Parameterized tests have a different signature for the filter
if(${test_type} STREQUAL "TEST_P")
if("x${test_type}" STREQUAL "xTEST_P")
string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit})
elseif(${test_type} STREQUAL "TEST_F" OR ${test_type} STREQUAL "TEST")
elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST")
string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
elseif(${test_type} STREQUAL "TYPED_TEST")
elseif("x${test_type}" STREQUAL "xTYPED_TEST")
string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit})
else()
message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment