diff options
author | Moritz Haase <Moritz.Haase@bmw.de> | 2023-12-05 13:09:37 (GMT) |
---|---|---|
committer | Moritz Haase <Moritz.Haase@bmw.de> | 2023-12-06 11:52:18 (GMT) |
commit | 0767016eabf17ab124ae7b454b9ca910dcc17c56 (patch) | |
tree | c0b5e3115f618691206235468a18407d7017884d /.gitlab | |
parent | 98cbe249189463a9f31ba3b3bdd37dfd0710753d (diff) | |
download | CMake-0767016eabf17ab124ae7b454b9ca910dcc17c56.zip CMake-0767016eabf17ab124ae7b454b9ca910dcc17c56.tar.gz CMake-0767016eabf17ab124ae7b454b9ca910dcc17c56.tar.bz2 |
GoogleTest: Avoid silent failures of dynamic test discovery
The internal helper variable '_GOOGLETEST_DISCOVER_TESTS_SCRIPT' can have gone
out-of-scope when 'gtest_discover_tests()' is called, depending on where the
GoogleTest module is actually included. This leads to a silent failure of
dynamic test discovery, since the custom post-build commands actually does
nothing (it basically invokes 'cmake -P ""'). Ctest will then fail to run the
tests, considering them to be 'not built'.
Fix this by determining the path to the GoogleTest module based on
'${CMAKE_ROOT}' instead, which is always available.
A new test case was added to test suite 'RunCMake/GoogleTest' to ensure that
'gtest_discover_tests()' works correctly when invoked in a different variable
scope.
Fixes: #25477
Diffstat (limited to '.gitlab')
0 files changed, 0 insertions, 0 deletions