1 cmake_minimum_required(VERSION 2.8.8) 2 3 project(googletest-distribution) 4 set(GOOGLETEST_VERSION 1.9.0) 5 6 if (CMAKE_VERSION VERSION_LESS "3.1") 7 add_definitions(-std=c++11) 8 else() 9 set(CMAKE_CXX_STANDARD 11) 10 set(CMAKE_CXX_STANDARD_REQUIRED ON) 11 if(NOT CYGWIN) 12 set(CMAKE_CXX_EXTENSIONS OFF) 13 endif() 14 endif() 15 16 if (POLICY CMP0048) 17 cmake_policy(SET CMP0048 NEW) 18 endif (POLICY CMP0048) 19 20 enable_testing() 21 22 include(CMakeDependentOption) 23 include(GNUInstallDirs) 24 25 #Note that googlemock target already builds googletest 26 option(BUILD_GMOCK "Builds the googlemock subproject" ON) 27 option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 28 29 if(BUILD_GMOCK) 30 add_subdirectory( googlemock ) 31 else() 32 add_subdirectory( googletest ) 33 endif() 34