From b8d4b0693cc1bd1881a74c42dd19cc6d49e27307 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:01:18 -0400 Subject: [PATCH] Disable installing gtest when `cmake --install` (#37) * disable INSTALL_GTEST * update comments --- .ci/docker/ubuntu.Dockerfile | 2 +- CMakeLists.txt | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.ci/docker/ubuntu.Dockerfile b/.ci/docker/ubuntu.Dockerfile index 7f4e8db..74154ff 100644 --- a/.ci/docker/ubuntu.Dockerfile +++ b/.ci/docker/ubuntu.Dockerfile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# Using a non-LTS Ubuntu, just until CMake 3.24 is available on Ubuntu 24.04. +# Using a non-LTS Ubuntu, just until CMake 3.25 is available on Ubuntu 24.04 FROM ubuntu:23.10 # Install dependencies, diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c1642a..828ed70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# TODO Darius: Find CMake minimum required version. -cmake_minimum_required(VERSION 3.23) +cmake_minimum_required(VERSION 3.25) project( beman.exemplar # CMake Project Name, which is also the name of the top-level @@ -15,13 +14,18 @@ include(FetchContent) if(BUILD_TESTING) enable_testing() - # Fetch GoogleTest - FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0 - EXCLUDE_FROM_ALL CMAKE_ARGS -DBUILD_TESTING=OFF) - FetchContent_MakeAvailable(googletest) + block() + # Disable installing google test dependency on cmake --install + set(INSTALL_GTEST OFF) + + # Fetch GoogleTest + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0 + EXCLUDE_FROM_ALL CMAKE_ARGS -DBUILD_TESTING=OFF) + FetchContent_MakeAvailable(googletest) + endblock() endif() add_subdirectory(src/beman/exemplar)