mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
GoogleTest: Avoid cluttering custom working directory during discovery
Backport the functionality from commitb5f555f687(GoogleTest: Avoid cluttering custom working directory during discovery, 2026-06-07, v4.4.0-rc2~12^2). Work around the refactoring done in commit3748ca9fc7(GoogleTest: generate single discovery script, 2026-04-08, v4.4.0-rc1~302^2~1).
This commit is contained in:
@@ -704,6 +704,7 @@ function(gtest_discover_tests target)
|
||||
-D "TEST_DISCOVERY_TIMEOUT=${arg_DISCOVERY_TIMEOUT}"
|
||||
-D "TEST_DISCOVERY_EXTRA_ARGS=${arg_DISCOVERY_EXTRA_ARGS}"
|
||||
-D "TEST_XML_OUTPUT_DIR=${arg_XML_OUTPUT_DIR}"
|
||||
-D "TEST_JSON_OUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
-P "${CMAKE_ROOT}/Modules/GoogleTestAddTests.cmake"
|
||||
VERBATIM
|
||||
)
|
||||
@@ -747,6 +748,7 @@ function(gtest_discover_tests target)
|
||||
" TEST_DISCOVERY_TIMEOUT" " [==[${arg_DISCOVERY_TIMEOUT}]==]" "\n"
|
||||
" TEST_DISCOVERY_EXTRA_ARGS [==[${arg_DISCOVERY_EXTRA_ARGS}]==]" "\n"
|
||||
" TEST_XML_OUTPUT_DIR" " [==[${arg_XML_OUTPUT_DIR}]==]" "\n"
|
||||
" TEST_JSON_OUTPUT_DIR" " [==[${CMAKE_CURRENT_BINARY_DIR}]==]" "\n"
|
||||
" )" "\n"
|
||||
" endif()" "\n"
|
||||
" include(\"${ctest_tests_file}\")" "\n"
|
||||
|
||||
@@ -294,6 +294,7 @@ function(gtest_discover_tests_impl)
|
||||
CTEST_FILE
|
||||
TEST_DISCOVERY_TIMEOUT
|
||||
TEST_XML_OUTPUT_DIR
|
||||
TEST_JSON_OUTPUT_DIR
|
||||
# The following are all multi-value arguments in gtest_discover_tests(),
|
||||
# but they are each given to us as a single argument. We parse them that
|
||||
# way to avoid problems with preserving empty list values and escaping.
|
||||
@@ -355,7 +356,7 @@ function(gtest_discover_tests_impl)
|
||||
string(SHA256 target_hash "${arg_TEST_TARGET}")
|
||||
string(SUBSTRING "${target_hash}" 0 10 target_hash)
|
||||
set(json_file
|
||||
"${arg_TEST_WORKING_DIR}/cmake_test_discovery_${target_hash}.json"
|
||||
"${arg_TEST_JSON_OUTPUT_DIR}/cmake_test_discovery_${target_hash}.json"
|
||||
)
|
||||
|
||||
# Remove json file to make sure we don't pick up an outdated one
|
||||
@@ -435,6 +436,7 @@ if(CMAKE_SCRIPT_MODE_FILE)
|
||||
CTEST_FILE ${CTEST_FILE}
|
||||
TEST_DISCOVERY_TIMEOUT ${TEST_DISCOVERY_TIMEOUT}
|
||||
TEST_XML_OUTPUT_DIR ${TEST_XML_OUTPUT_DIR}
|
||||
TEST_JSON_OUTPUT_DIR ${TEST_JSON_OUTPUT_DIR}
|
||||
TEST_EXTRA_ARGS "${TEST_EXTRA_ARGS}"
|
||||
TEST_DISCOVERY_EXTRA_ARGS "${TEST_DISCOVERY_EXTRA_ARGS}"
|
||||
TEST_PROPERTIES "${TEST_PROPERTIES}"
|
||||
|
||||
Reference in New Issue
Block a user