Files
CMake/Modules
Ryan Thornton 889a7146ff GoogleTestAddTests: Refactor into callable method
Move test discovery logic into new gtest_discover_tests_impl method
and make GoogleTestAddTests aware of whether it is being launched in
CMake's script mode.

When launched in script mode, gtest_discover_tests_impl is called
passing arguments obtained from the definitions passed into the call to cmake.
(i.e. cmake -P GoogleTestAddTests -D <arg1> -D <arg2> ...)

This preserves the existing behavior assumed by GoogleTest.cmake.
Unit tests are unchanged and still pass.

Looking ahead, it also allows GoogleTestAddTests to be included in generated files
and call gtest_discover_tests_impl to perform test discovery at test runtime
with the new PRE_TEST discovery mode introduced later in this branch.

My original approach attempted to call execute_process(cmake -P ...) in
the generated file, the same way POST_BUILD is doing, but I ran into
difficulties serializing the command arguments correctly.

By exposing a way to call gtest_discover_tests_impl directly from our generated file,
we remove a layer of shell quoting / parsing that our arguments have to survive,
which simplifies the act of producing a generated file that behaves the
same as its POST_BUILD counterpart.
2020-03-19 11:59:20 -05:00
..
2020-03-16 11:31:25 -04:00
2019-10-11 10:22:52 -04:00
2018-02-16 09:47:17 -05:00
2020-02-12 09:20:59 -05:00
2019-07-03 11:57:53 +03:00

See the "Find Modules" section of the cmake-developer(7) manual page.

For more information about how to contribute modules to CMake, see this page:
https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/dev/Module-Maintainers