blob: 755b8b72b56df34115a4f11bfa829251cc603aa6 [file] [log] [blame]
Enji Cooper699943f2019-05-19 23:29:18 -07001# Note: CMake support is community-based. The maintainers do not use CMake
misterg63be3dc2019-04-29 17:18:42 -04002# internally.
3
Dakota Hawkins759ef7c2018-07-24 11:06:55 -04004cmake_minimum_required(VERSION 2.8.8)
peter96824f12018-10-24 12:03:07 +08005
Matthijs Brobbel97d8c472019-05-28 11:06:26 +02006if (POLICY CMP0048)
7 cmake_policy(SET CMP0048 NEW)
8endif (POLICY CMP0048)
9
Matthias Grob67265e02019-02-04 18:59:51 +000010project(googletest-distribution)
Abseil Team703bd9c2019-10-03 10:39:13 -040011set(GOOGLETEST_VERSION 1.10.0)
Matthias Grob67265e02019-02-04 18:59:51 +000012
peter96824f12018-10-24 12:03:07 +080013if (CMAKE_VERSION VERSION_LESS "3.1")
14 add_definitions(-std=c++11)
15else()
16 set(CMAKE_CXX_STANDARD 11)
peter478a5182018-10-24 12:17:06 +080017 set(CMAKE_CXX_STANDARD_REQUIRED ON)
Ilya Kravchuk20b8e7a2019-12-13 12:54:37 +030018 if(NOT CYGWIN AND NOT MSYS)
Matthias Grobf8925342019-02-04 19:01:11 +000019 set(CMAKE_CXX_EXTENSIONS OFF)
20 endif()
peter96824f12018-10-24 12:03:07 +080021endif()
Fábio Junqueira4a0b77f2015-11-11 18:29:41 -020022
Fábio Junqueira4a0b77f2015-11-11 18:29:41 -020023enable_testing()
24
Matthew Woehlke0e8e0e02017-08-09 15:29:36 -040025include(CMakeDependentOption)
Dakota Hawkins759ef7c2018-07-24 11:06:55 -040026include(GNUInstallDirs)
Matthew Woehlke0e8e0e02017-08-09 15:29:36 -040027
Fábio Junqueira4a0b77f2015-11-11 18:29:41 -020028#Note that googlemock target already builds googletest
29option(BUILD_GMOCK "Builds the googlemock subproject" ON)
Stefano Soffiaaff03792017-12-01 12:48:46 +010030option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
Matthew Woehlke9469fb62017-08-16 10:49:06 -040031
Fábio Junqueira4a0b77f2015-11-11 18:29:41 -020032if(BUILD_GMOCK)
33 add_subdirectory( googlemock )
Stefano Soffiaaff03792017-12-01 12:48:46 +010034else()
Fábio Junqueira4a0b77f2015-11-11 18:29:41 -020035 add_subdirectory( googletest )
36endif()