MantisBT - CMake
View Issue Details
0010065CMakeModulespublic2009-12-18 11:482015-05-04 10:06
rtward 
Philip Lowman 
normalminoralways
closedfixed 
CMake-2-8 
 
0010065: FindGTest.cmake doesn't handle spaces around arguments to TEST / TEST_F macro
The FindGTest.cmake module expects the GTest macro to have the format:

TEST(test_case,test_name)

or

TEST_F(test_case,test_name)

and it fails if there is any space padding between the arguments like this:

TEST( test_case, test_name )

or

TEST_F( test_case, test_name )

I've provided a patch that I believe fixes the problem. It changes line 79 of FindGTest.cmake from:

string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit})

to

string(REGEX REPLACE ".*\\(( *[A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})

adding in regex elements that will catch leading and trailing spaces that pad the macro arguments.
No tags attached.
related to 0015553closed  FindGTest.cmake doesn't handle all spaces in TEST / TEST_F macro 
diff FindGTest_fix.diff (234) 2009-12-18 11:48
https://public.kitware.com/Bug/file/2729/FindGTest_fix.diff
Issue History
2009-12-18 11:48rtwardNew Issue
2009-12-18 11:48rtwardFile Added: FindGTest_fix.diff
2009-12-18 17:50rtwardNote Added: 0018949
2010-01-05 00:17Philip LowmanNote Added: 0019031
2010-01-05 00:17Philip LowmanAssigned To => Philip Lowman
2010-01-05 00:17Philip LowmanStatusnew => resolved
2010-01-05 00:17Philip LowmanResolutionopen => fixed
2010-01-05 01:00Philip LowmanStatusresolved => feedback
2010-01-05 01:00Philip LowmanResolutionfixed => reopened
2010-01-05 01:01Philip LowmanStatusfeedback => resolved
2010-01-05 01:01Philip LowmanResolutionreopened => fixed
2010-01-05 01:01Philip LowmanCategoryCMake => Modules
2010-09-01 00:13Philip LowmanStatusresolved => closed
2015-05-04 10:06Brad KingRelationship addedrelated to 0015553

Notes
(0018949)
rtward   
2009-12-18 17:50   
Noticed a bug, the corrected line should be:
string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
(0019031)
Philip Lowman   
2010-01-05 00:17   
Thanks for the patch, fixed in CVS. Also documented the fact that CMake must be manually rerun after adding/removing tests as part of the source file.