GoogleTest: Optimize gtest_discover_tests
gtest_discover_tests took multiple minutes if many tests are present.
This behavior was caused by a repeated addition to the variable script
using:
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
in the module file GoogleTestAddTests.cmake
This MR changes the following:
- The variable
script
is flushed to ${CTEST_FILE} if the variable becomes too large. - The buffer
tests_buffer
is introduced for the variabletests
. This buffer gets flushed intotests
once it becomes too large. -
cmake_minimum_required(VERSION ${CMAKE_VERSION})
is added at the beginning of the script. - The usage of
set()
to append to a string is replaced withstring(APPEND ...)
For timing tests see below.
Topic-rename: GoogleTest-optimize
Edited by Brad King