2018-07-24 18:06:55 +03:00
cmake_minimum_required ( VERSION 2.8.8 )
2015-11-11 23:29:41 +03:00
2017-08-03 06:50:45 +03:00
if ( POLICY CMP0048 )
2017-08-03 04:03:13 +03:00
cmake_policy ( SET CMP0048 NEW )
2017-08-03 06:50:45 +03:00
endif ( POLICY CMP0048 )
2017-08-03 04:03:13 +03:00
2018-07-24 18:06:55 +03:00
project ( googletest-distribution )
set ( GOOGLETEST_VERSION 1.9.0 )
2015-11-11 23:29:41 +03:00
enable_testing ( )
2017-08-09 22:29:36 +03:00
include ( CMakeDependentOption )
2018-07-24 18:06:55 +03:00
include ( GNUInstallDirs )
2017-08-09 22:29:36 +03:00
2015-11-11 23:29:41 +03:00
option ( BUILD_GTEST "Builds the googletest subproject" OFF )
#Note that googlemock target already builds googletest
option ( BUILD_GMOCK "Builds the googlemock subproject" ON )
2017-08-16 17:49:06 +03:00
cmake_dependent_option ( INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF )
2017-08-09 22:29:36 +03:00
cmake_dependent_option ( INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF )
2015-11-11 23:29:41 +03:00
2018-07-24 18:06:55 +03:00
if ( WIN32 )
set ( INSTALL_CMAKE_DIR "cmake" CACHE PATH "CMake exported targets" )
else ( )
set ( INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/gtest" CACHE PATH "CMake exported targets" )
endif ( )
set ( googletest_install_targets )
2015-11-11 23:29:41 +03:00
if ( BUILD_GMOCK )
add_subdirectory ( googlemock )
elseif ( BUILD_GTEST )
add_subdirectory ( googletest )
endif ( )
2018-07-24 18:06:55 +03:00
if ( googletest_install_targets )
include ( CMakePackageConfigHelpers )
configure_package_config_file (
" $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / c m a k e / g o o g l e t e s t C o n f i g . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / g o o g l e t e s t C o n f i g . c m a k e "
I N S T A L L _ D E S T I N A T I O N " $ { I N S T A L L _ C M A K E _ D I R } " )
write_basic_package_version_file (
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / g o o g l e t e s t C o n f i g V e r s i o n . c m a k e
V E R S I O N " $ { G O O G L E T E S T _ V E R S I O N } "
C O M P A T I B I L I T Y S a m e M a j o r V e r s i o n )
install ( FILES
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / g o o g l e t e s t C o n f i g . c m a k e
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / g o o g l e t e s t C o n f i g V e r s i o n . c m a k e
D E S T I N A T I O N " $ { I N S T A L L _ C M A K E _ D I R } " )
endif ( )