From ba5747fc12ab0c3c7129d505edd9f26113c976f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:16:15 +0000 Subject: [PATCH 1/2] Initial plan From 67e7d9b9e3a34f50f3ebf333f3d928ae571c9507 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:17:42 +0000 Subject: [PATCH 2/2] Refactor FetchContent_Declare to avoid duplication using a variable Co-authored-by: derobins <43805+derobins@users.noreply.github.com> --- cmake/AISUseGTest.cmake | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/cmake/AISUseGTest.cmake b/cmake/AISUseGTest.cmake index d80afee..bdc87bf 100644 --- a/cmake/AISUseGTest.cmake +++ b/cmake/AISUseGTest.cmake @@ -4,27 +4,22 @@ include(FetchContent) -# This line is used (or not) in FetchContent_Declare to determine -# if we check for a system GoogleTest install first. When building -# with the sanitizers, we HAVE to build GoogleTest from source. -# -# lint_cmake: -readability/wonkycase +# When building with the sanitizers, we HAVE to build GoogleTest from source, +# so we skip the system package check. Otherwise, check for a system install first. if(AIS_USE_SANITIZERS OR AIS_USE_INTEGER_SANITIZER OR AIS_USE_THREAD_SANITIZER) - FetchContent_Declare( - googletest - URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz - DOWNLOAD_EXTRACT_TIMESTAMP true - SYSTEM - ) + set(_gtest_find_package_args "") else() - FetchContent_Declare( - googletest - URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz - DOWNLOAD_EXTRACT_TIMESTAMP true - FIND_PACKAGE_ARGS NAMES GTest # <-- Different - SYSTEM - ) + set(_gtest_find_package_args FIND_PACKAGE_ARGS NAMES GTest) endif() + +# lint_cmake: -readability/wonkycase +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz + DOWNLOAD_EXTRACT_TIMESTAMP true + ${_gtest_find_package_args} + SYSTEM +) # lint_cmake: +readability/wonkycase set(INSTALL_GTEST OFF CACHE BOOL "Don't install GoogleTest")