CMakeLists.txt 986 B

123456789101112131415161718192021222324252627282930313233343536
  1. # Note: CMake support is community-based. The maintainers do not use CMake
  2. # internally.
  3. cmake_minimum_required(VERSION 3.13)
  4. project(googletest-distribution)
  5. set(GOOGLETEST_VERSION 1.15.2)
  6. if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
  7. set(CMAKE_CXX_EXTENSIONS OFF)
  8. endif()
  9. enable_testing()
  10. include(CMakeDependentOption)
  11. include(GNUInstallDirs)
  12. # Note that googlemock target already builds googletest.
  13. option(BUILD_GMOCK "Builds the googlemock subproject" ON)
  14. option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
  15. option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)
  16. if(GTEST_HAS_ABSL)
  17. if(NOT TARGET absl::base)
  18. find_package(absl REQUIRED)
  19. endif()
  20. if(NOT TARGET re2::re2)
  21. find_package(re2 REQUIRED)
  22. endif()
  23. endif()
  24. if(BUILD_GMOCK)
  25. add_subdirectory( googlemock )
  26. else()
  27. add_subdirectory( googletest )
  28. endif()