summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-28 14:48:36 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-02-28 14:48:36 (GMT)
commite62102bef1c24c843e81e7c7da7a65c360afc7e3 (patch)
tree024628db16301b94d653bab465cd881c84b4dc68 /Modules
parentf23cc1d3d8a75b4406f61e24940d42758d3d663d (diff)
parentac42bca8330e0501d2fbf80dbe6d4d93234ba0c0 (diff)
downloadCMake-e62102bef1c24c843e81e7c7da7a65c360afc7e3.zip
CMake-e62102bef1c24c843e81e7c7da7a65c360afc7e3.tar.gz
CMake-e62102bef1c24c843e81e7c7da7a65c360afc7e3.tar.bz2
Merge topic 'FindGTest-AUTO-SOURCES'
ac42bca8 Help: Add FindGTest-AUTO-SOURCES topic release notes c50325b8 FindGTest: Optionally detect sources automatically (#14775)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindGTest.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index c00a750..aa3c235 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -79,7 +79,7 @@
# extra_args = Pass a list of extra arguments to be passed to
# executable enclosed in quotes (or "" for none)
# ARGN = A list of source files to search for tests & test
-# fixtures.
+# fixtures. Or AUTO to find them from executable target.
#
#
#
@@ -88,7 +88,7 @@
# Example:
# set(FooTestArgs --foo 1 --bar 2)
# add_executable(FooTest FooUnitTest.cc)
-# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc)
+# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -111,6 +111,10 @@ function(GTEST_ADD_TESTS executable extra_args)
if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
endif()
+ if(ARGN STREQUAL "AUTO")
+ # obtain sources used for building that executable
+ get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+ endif()
foreach(source ${ARGN})
file(READ "${source}" contents)
string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})