diff options
author | Ryan Thornton <ThorntonRyan@JohnDeere.com> | 2020-03-16 16:59:12 (GMT) |
---|---|---|
committer | Ryan Thornton <ThorntonRyan@JohnDeere.com> | 2020-03-19 16:59:20 (GMT) |
commit | 889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d (patch) | |
tree | 60856ec356292bdef0a0c0b079dee74ce2861cda /Tests/RunCMake/GoogleTest/RunCMakeTest.cmake | |
parent | 60db3af147e03e6073ecd6c5729d627d4af66a67 (diff) | |
download | CMake-889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d.zip CMake-889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d.tar.gz CMake-889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d.tar.bz2 |
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.
Diffstat (limited to 'Tests/RunCMake/GoogleTest/RunCMakeTest.cmake')
0 files changed, 0 insertions, 0 deletions