From ed4a300bc206fa8450948c35582559ef6c596a07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu>
Date: Tue, 17 May 2022 15:51:27 +0200
Subject: [PATCH] simpler way of disabling gtest installation

---
 test/gtest/CMakeLists.txt | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt
index d066e22..b208087 100644
--- a/test/gtest/CMakeLists.txt
+++ b/test/gtest/CMakeLists.txt
@@ -55,13 +55,8 @@ else()
     GIT_REPOSITORY https://github.com/google/googletest.git 
     GIT_TAG main)
 
-  #FetchContent_MakeAvailable(googletest)
-  # Disable installation of googletest: https://stackoverflow.com/questions/65527126/disable-install-for-fetchcontent
-  FetchContent_GetProperties(googletest)
-  if(NOT googletest_POPULATED)
-    FetchContent_Populate(googletest)
-    add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
-  endif()
+  SET(INSTALL_GTEST OFF) # Disable installation of googletest
+  FetchContent_MakeAvailable(googletest)
     
 endif()
   
-- 
GitLab