From 832858195ec4e9ac1ef513d7c2974d62a4f941c7 Mon Sep 17 00:00:00 2001 From: Adam Badura Date: Sun, 26 Jul 2020 04:19:02 -0400 Subject: GoogleTest: Fix include path in the generated file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The generated ..._include.cmake file contained an inclusion of GoogleTestAddTests without any path. In general, this is a good approach since it enables to correctly catch possibly user-customized files. However, in this case, it didn’t work this way since the ..._include.cmake file is evaluated by a separate CMake call under a custom command. Because of this, the CMAKE_MODULE_PATH is not set as expected by the user and the said inclusion catches CMake own version of the module rather than the possibly user-customized one. This change fixes this by making the inclusion with an absolute path determined upon the ..._include.cmake file generation. --- Modules/GoogleTest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 2ef7382..057b29d 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -495,7 +495,7 @@ function(gtest_discover_tests TARGET) string(CONCAT ctest_include_content "if(EXISTS \"$\")" "\n" " if(\"$\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n" - " include(GoogleTestAddTests)" "\n" + " include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n" " gtest_discover_tests_impl(" "\n" " TEST_EXECUTABLE" " [==[" "$" "]==]" "\n" " TEST_EXECUTOR" " [==[" "${crosscompiling_emulator}" "]==]" "\n" -- cgit v0.12