summaryrefslogtreecommitdiff
path: root/Modules/FindGTest.cmake
diff options
context:
space:
mode:
authorZak Eckert <eckertzs1@gmail.com>2016-03-11 11:23:32 -0500
committerBrad King <brad.king@kitware.com>2016-03-15 15:21:37 -0400
commita5d3d003d0192f8d5fd87885f948338c04fc3f85 (patch)
tree1061a18c642a952b3d132d4c5e9cb377f385cda9 /Modules/FindGTest.cmake
parent1d4ab06a7045edf366c689ba5e29bbc35d08718e (diff)
downloadcmake-a5d3d003d0192f8d5fd87885f948338c04fc3f85.tar.gz
FindGTest: Automatically re-run cmake when tests change
Tell CMake that it needs to re-run when test source files parsed by `gtest_add_tests` change so that we can re-scan for tests automatically.
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r--Modules/FindGTest.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index ca49e4aca7..a7ffcfefed 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -82,8 +82,7 @@
# ``AUTO`` to find them from executable target
#
# However, note that this macro will slow down your tests by running
-# an executable for each test and test fixture. You will also have to
-# re-run CMake after adding or removing tests or test fixtures.
+# an executable for each test and test fixture.
#
# Example usage::
#
@@ -119,6 +118,7 @@ function(GTEST_ADD_TESTS executable extra_args)
set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
foreach(source ${ARGN})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
file(READ "${source}" contents)
string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
foreach(hit ${found_tests})