summaryrefslogtreecommitdiff
path: root/Modules/GoogleTest.cmake
diff options
context:
space:
mode:
authorRyan Thornton <ThorntonRyan@JohnDeere.com>2020-03-16 11:59:12 -0500
committerRyan Thornton <ThorntonRyan@JohnDeere.com>2020-03-19 11:59:20 -0500
commit889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d (patch)
tree60856ec356292bdef0a0c0b079dee74ce2861cda /Modules/GoogleTest.cmake
parent60db3af147e03e6073ecd6c5729d627d4af66a67 (diff)
downloadcmake-889a7146ff8a1b3ca73cfa14e07fae7ae6ee706d.tar.gz
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 'Modules/GoogleTest.cmake')
0 files changed, 0 insertions, 0 deletions