diff options
author | Philip Lowman <philip@yhbt.com> | 2010-01-05 05:14:58 (GMT) |
---|---|---|
committer | Philip Lowman <philip@yhbt.com> | 2010-01-05 05:14:58 (GMT) |
commit | eb66705db445499e1b9f0cd26189eae8fa0b03a5 (patch) | |
tree | b8aafafca8675cc76507006a584d953e00b681c3 /Modules/FindGTest.cmake | |
parent | e0d09ef0a8bfa71dc7b12580ada7f18bca47a12c (diff) | |
download | CMake-eb66705db445499e1b9f0cd26189eae8fa0b03a5.zip CMake-eb66705db445499e1b9f0cd26189eae8fa0b03a5.tar.gz CMake-eb66705db445499e1b9f0cd26189eae8fa0b03a5.tar.bz2 |
Fix issue #10065, "FindGTest.cmake doesn't handle spaces around arguments to TEST/TEST_F macro".
Also improved the documentation.
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r-- | Modules/FindGTest.cmake | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 4960b38..1bcd469 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -15,16 +15,17 @@ # # Accepts the following variables as input: # -# GTEST_ROOT - (as CMake or env. variable) +# GTEST_ROOT - (as a CMake or environment variable) # The root directory of the gtest install prefix # -# GTEST_MSVC_SEARCH - If on MSVC, enables searching the build tree of -# GTest if set to MD or MT (defaults: MD) +# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to +# "MD" or "MT" to enable searching a GTest build tree +# (defaults: "MD") # #----------------------- # Example Usage: # -# enable_testing(true) +# enable_testing() # find_package(GTest REQUIRED) # include_directories(${GTEST_INCLUDE_DIRS}) # @@ -36,8 +37,10 @@ #----------------------- # # If you would like each Google test to show up in CTest as -# a test you may use the following macro. NOTE: It WILL slow -# down your tests, so be warned. +# a test you may use the following macro. +# NOTE: It will slow down your tests by running an executable +# for each test and test fixture. You will also have to rerun +# CMake after adding or removing tests or test fixtures. # # GTEST_ADD_TESTS(executable extra_args ARGN) # executable = The path to the test executable @@ -76,7 +79,7 @@ function(GTEST_ADD_TESTS executable extra_args) file(READ "${source}" contents) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit}) + string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) endforeach() endforeach() |