Warning, /acts/Traccc/extern/googletest/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # TRACCC library, part of the ACTS project (R&D line)
0002 #
0003 # (c) 2021-2024 CERN for the benefit of the ACTS project
0004 #
0005 # Mozilla Public License Version 2.0
0006
0007 # CMake include(s).
0008 cmake_minimum_required(VERSION 3.25)
0009 include(FetchContent)
0010
0011 # Tell the user what's happening.
0012 message(STATUS "Building GoogleTest as part of the TRACCC project")
0013
0014 # Declare where to get GoogleTest from.
0015 set(TRACCC_GOOGLETEST_SOURCE
0016 "URL;https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz;URL_MD5;7e11f6cfcf6498324ac82d567dcb891e"
0017 CACHE STRING
0018 "Source for GoogleTest, when built as part of this project"
0019 )
0020 mark_as_advanced(TRACCC_GOOGLETEST_SOURCE)
0021 FetchContent_Declare(GoogleTest SYSTEM ${TRACCC_GOOGLETEST_SOURCE})
0022
0023 # Options used in the build of GoogleTest.
0024 set(BUILD_GMOCK TRUE CACHE BOOL "Turn off the build of GMock")
0025 set(INSTALL_GTEST FALSE CACHE BOOL "Turn off the installation of GoogleTest")
0026 if(WIN32)
0027 set(gtest_force_shared_crt
0028 TRUE
0029 CACHE BOOL
0030 "Use shared (DLL) run-time library, even with static libraries"
0031 )
0032 endif()
0033
0034 # Silence some warnings with modern versions of CMake on macOS.
0035 set(CMAKE_MACOSX_RPATH TRUE)
0036
0037 # Get it into the current directory.
0038 FetchContent_MakeAvailable(GoogleTest)
0039
0040 # Set up aliases for the GTest targets with the same name that they have
0041 # when we find GTest pre-installed.
0042 if(NOT TARGET GTest::gtest)
0043 add_library(GTest::gtest ALIAS gtest)
0044 endif()
0045 if(NOT TARGET GTest::gtest_main)
0046 add_library(GTest::gtest_main ALIAS gtest_main)
0047 endif()