2019-05-20 14:29:18 +08:00
|
|
|
# Note: CMake support is community-based. The maintainers do not use CMake
|
2019-04-30 05:18:42 +08:00
|
|
|
# internally.
|
|
|
|
|
2023-06-20 23:20:43 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2019-05-28 17:06:26 +08:00
|
|
|
|
2019-02-05 02:59:51 +08:00
|
|
|
project(googletest-distribution)
|
2024-08-01 21:34:07 +08:00
|
|
|
set(GOOGLETEST_VERSION 1.15.2)
|
2019-02-05 02:59:51 +08:00
|
|
|
|
2021-08-21 05:47:35 +08:00
|
|
|
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
2018-10-24 12:03:07 +08:00
|
|
|
endif()
|
2015-11-12 04:29:41 +08:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2017-08-10 03:29:36 +08:00
|
|
|
include(CMakeDependentOption)
|
2018-07-24 23:06:55 +08:00
|
|
|
include(GNUInstallDirs)
|
2017-08-10 03:29:36 +08:00
|
|
|
|
2023-09-29 22:26:23 +08:00
|
|
|
# Note that googlemock target already builds googletest.
|
2015-11-12 04:29:41 +08:00
|
|
|
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
|
2017-12-01 19:48:46 +08:00
|
|
|
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
|
2022-10-19 12:39:44 +08:00
|
|
|
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)
|
2017-08-16 22:49:06 +08:00
|
|
|
|
2023-12-02 06:09:45 +08:00
|
|
|
if(GTEST_HAS_ABSL)
|
|
|
|
if(NOT TARGET absl::base)
|
|
|
|
find_package(absl REQUIRED)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET re2::re2)
|
|
|
|
find_package(re2 REQUIRED)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-11-12 04:29:41 +08:00
|
|
|
if(BUILD_GMOCK)
|
|
|
|
add_subdirectory( googlemock )
|
2017-12-01 19:48:46 +08:00
|
|
|
else()
|
2015-11-12 04:29:41 +08:00
|
|
|
add_subdirectory( googletest )
|
|
|
|
endif()
|