From abad8af018b232a089ea6397383a2b8fc4422cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Sroczy=C5=84ski?= Date: Tue, 14 Mar 2023 23:48:08 +0100 Subject: [PATCH 01/24] Add COMPONENT to install --- googletest/CMakeLists.txt | 2 ++ googletest/cmake/internal_utils.cmake | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index 95bfa4420..d06c14797 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -100,12 +100,14 @@ if (INSTALL_GTEST) set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake") write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion) install(EXPORT ${targets_export_name} + COMPONENT "${PROJECT_NAME}" NAMESPACE ${cmake_package_name}:: DESTINATION ${cmake_files_install_dir}) set(config_file "${generated_dir}/${cmake_package_name}Config.cmake") configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in" "${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir}) install(FILES ${version_file} ${config_file} + COMPONENT "${PROJECT_NAME}" DESTINATION ${cmake_files_install_dir}) endif() diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index b09da33fa..edf637e22 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -327,10 +327,12 @@ endfunction() function(install_project) if(INSTALL_GTEST) install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" + COMPONENT "${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # Install the project targets. install(TARGETS ${ARGN} EXPORT ${targets_export_name} + COMPONENT "${PROJECT_NAME}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") @@ -342,6 +344,7 @@ function(install_project) get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY) install(FILES "${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$:${t_pdb_name_debug}>$<$>:${t_pdb_name}>.pdb" + COMPONENT "${PROJECT_NAME}" DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL) endforeach() @@ -352,6 +355,7 @@ function(install_project) configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in" "${configured_pc}" @ONLY) install(FILES "${configured_pc}" + COMPONENT "${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endforeach() endif() From a7fa9b37082993107a98181e631cafcdbe484f22 Mon Sep 17 00:00:00 2001 From: yagneshprajapati <131433627+yagneshprajapati@users.noreply.github.com> Date: Sun, 7 May 2023 15:22:54 +0530 Subject: [PATCH 02/24] Update README.md --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23eb5026d..1284b8d32 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together. -### Getting Started +### | Getting Started | See the [GoogleTest User's Guide](https://google.github.io/googletest/) for documentation. We recommend starting with the @@ -50,18 +50,19 @@ documentation. We recommend starting with the More information about building GoogleTest can be found at [googletest/README.md](googletest/README.md). -## Features +| Feature | Description | +| --- | --- | +| xUnit test framework | Googletest is based on the xUnit testing framework, a popular architecture for unit testing | +| Test discovery | Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests | +| Rich set of assertions | Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code | +| User-defined assertions | You can define your own assertions with Googletest, making it simple to write tests that are specific to your code | +| Death tests | Googletest supports death tests, which verify that your code exits in a certain way, making it useful for testing error-handling code | +| Fatal and non-fatal failures | You can specify whether a test failure should be treated as fatal or non-fatal with Googletest, allowing tests to continue running even if a failure occurs | +| Value-parameterized tests | Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs | +| Type-parameterized tests | Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types | +| Various options for running tests | Googletest provides many options for running tests, including running individual tests, running tests in a specific order, and running tests in parallel | +| XML test report generation | Googletest can generate XML test reports, which can be used by tools like Jenkins to track the results of your tests | -* An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework. -* Test discovery. -* A rich set of assertions. -* User-defined assertions. -* Death tests. -* Fatal and non-fatal failures. -* Value-parameterized tests. -* Type-parameterized tests. -* Various options for running the tests. -* XML test report generation. ## Supported Platforms From 0eb33cfa5c232f190efc6bb5fc215d5f35cca9d7 Mon Sep 17 00:00:00 2001 From: pateldeev Date: Mon, 8 May 2023 13:02:56 -0700 Subject: [PATCH 03/24] Add missing absl dependency from build. --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index ac62251e1..b1e3b7fba 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -132,6 +132,7 @@ cc_library( }), deps = select({ ":has_absl": [ + "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/debugging:failure_signal_handler", "@com_google_absl//absl/debugging:stacktrace", "@com_google_absl//absl/debugging:symbolize", From 88295d64a7832408be57825720fcf44e007a4199 Mon Sep 17 00:00:00 2001 From: yagneshprajapati <131433627+yagneshprajapati@users.noreply.github.com> Date: Thu, 11 May 2023 14:52:16 +0530 Subject: [PATCH 04/24] Update README.md xunit link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1284b8d32..55ec8f25c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ More information about building GoogleTest can be found at | Feature | Description | | --- | --- | -| xUnit test framework | Googletest is based on the xUnit testing framework, a popular architecture for unit testing | +| [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework | Googletest is based on the xUnit testing framework, a popular architecture for unit testing | | Test discovery | Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests | | Rich set of assertions | Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code | | User-defined assertions | You can define your own assertions with Googletest, making it simple to write tests that are specific to your code | From 7345a66cbd7149fa4126e526a94708b3f5d7d3b4 Mon Sep 17 00:00:00 2001 From: yagneshprajapati <131433627+yagneshprajapati@users.noreply.github.com> Date: Thu, 11 May 2023 14:54:04 +0530 Subject: [PATCH 05/24] Update README.md xUnit link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55ec8f25c..ce9a82bea 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together. -### | Getting Started | +### Getting Started See the [GoogleTest User's Guide](https://google.github.io/googletest/) for documentation. We recommend starting with the @@ -52,7 +52,7 @@ More information about building GoogleTest can be found at | Feature | Description | | --- | --- | -| [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework | Googletest is based on the xUnit testing framework, a popular architecture for unit testing | +| xUnit test framework | Googletest is based on the [xUnit](https://en.wikipedia.org/wiki/XUnit) testing framework, a popular architecture for unit testing | | Test discovery | Googletest automatically discovers and runs your tests, eliminating the need to manually register your tests | | Rich set of assertions | Googletest provides a variety of assertions, such as equality, inequality, exceptions, and more, making it easy to test your code | | User-defined assertions | You can define your own assertions with Googletest, making it simple to write tests that are specific to your code | From a8e067ae5f4e08cc16e24d1ed9f37971c971b8c9 Mon Sep 17 00:00:00 2001 From: yagneshprajapati <131433627+yagneshprajapati@users.noreply.github.com> Date: Thu, 11 May 2023 14:57:47 +0530 Subject: [PATCH 06/24] Update README.md xml report gan removed --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ce9a82bea..54f534e0d 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,6 @@ More information about building GoogleTest can be found at | Value-parameterized tests | Googletest supports value-parameterized tests, which run multiple times with different input values, making it useful for testing functions that take different inputs | | Type-parameterized tests | Googletest also supports type-parameterized tests, which run with different data types, making it useful for testing functions that work with different data types | | Various options for running tests | Googletest provides many options for running tests, including running individual tests, running tests in a specific order, and running tests in parallel | -| XML test report generation | Googletest can generate XML test reports, which can be used by tools like Jenkins to track the results of your tests | ## Supported Platforms From d6fb5e3bf76c0363d7519373a07c2435e57c1073 Mon Sep 17 00:00:00 2001 From: Dino Radakovic Date: Tue, 16 May 2023 07:05:07 -0700 Subject: [PATCH 07/24] Explicitly document googletest release tag format Fixes #4235 PiperOrigin-RevId: 532446854 Change-Id: If7e1dade02a80d9a30813c136bba3f20c796f0fa --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 14bb9e316..a3bd4bd85 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ GoogleTest now follows the [Abseil Live at Head philosophy](https://abseil.io/about/philosophy#upgrade-support). We recommend [updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it). +We do publish occasional semantic versions, tagged with +`v${major}.${minor}.${patch}` (e.g. `v.1.13.0`). #### Documentation Updates From cb455a71fb23303e37ce8ee5b1cde6a2c18f66a5 Mon Sep 17 00:00:00 2001 From: Dino Radakovic Date: Wed, 17 May 2023 08:30:21 -0700 Subject: [PATCH 08/24] Fix typo in version number example in README PiperOrigin-RevId: 532796425 Change-Id: If81029216cf12b9b05f8e2d79671ba106ebd28fb --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3bd4bd85..10d1f86f1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ GoogleTest now follows the We recommend [updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it). We do publish occasional semantic versions, tagged with -`v${major}.${minor}.${patch}` (e.g. `v.1.13.0`). +`v${major}.${minor}.${patch}` (e.g. `v1.13.0`). #### Documentation Updates From aa99ce5a0db4215bb8e2cda3ee68b6b8d4896815 Mon Sep 17 00:00:00 2001 From: Shlomi Nissan Date: Sun, 21 May 2023 16:40:06 -0700 Subject: [PATCH 09/24] Add CXX_STANDARD_REQUIRED to CMake quickstart --- docs/quickstart-cmake.md | 1 + googletest/README.md | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/quickstart-cmake.md b/docs/quickstart-cmake.md index 5abe50441..4e422b74f 100644 --- a/docs/quickstart-cmake.md +++ b/docs/quickstart-cmake.md @@ -54,6 +54,7 @@ project(my_project) # GoogleTest requires at least C++14 set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) FetchContent_Declare( diff --git a/googletest/README.md b/googletest/README.md index 995834e46..dc605716a 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -126,10 +126,10 @@ match the project in which it is included. An environment that supports C++11 is required in order to successfully build GoogleTest. One way to ensure this is to specify the standard in the top-level -project, for example by using the `set(CMAKE_CXX_STANDARD 11)` command. If this -is not feasible, for example in a C project using GoogleTest for validation, -then it can be specified by adding it to the options for cmake via the -`DCMAKE_CXX_FLAGS` option. +project, for example by using the `set(CMAKE_CXX_STANDARD 11)` command along +with `set(CMAKE_CXX_STANDARD_REQUIRED ON). If this is not feasible, for example +in a C project using GoogleTest for validation, then it can be specified by +adding it to the options for cmake via the `-DCMAKE_CXX_FLAGS` option. ### Tweaking GoogleTest From e032d57642d2a042b9445b2199277bb24fee2eb5 Mon Sep 17 00:00:00 2001 From: Niranjan Nilakantan Date: Wed, 24 May 2023 12:48:51 -0700 Subject: [PATCH 10/24] Build googletest with IntelLLVM compilers. Use the same flags as Clang if the compiler id is IntelLLVM. IntelLLVM warns if a double constant is assigned to a float. ``` [build] .../googletest/googletest/include/gtest/gtest-printers.h:516:17: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion] [build] mulfor6 = 1e1; ``` IntelLLVM uses fp-model=fast by default, breaking IsNan and IsInf tests. Use -ffp-model=precise to fix this. IntelLLVM does not support -Wchar-subscripts Fixes #4255 --- googletest/cmake/internal_utils.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index fa7da4e68..f45a3be00 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -94,12 +94,18 @@ macro(config_compiler_and_linker) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(cxx_base_flags "${cxx_base_flags} -utf-8") endif() - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") set(cxx_base_flags "-Wall -Wshadow -Wconversion -Wundef") set(cxx_exception_flags "-fexceptions") set(cxx_no_exception_flags "-fno-exceptions") - set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls") + set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Winline -Wredundant-decls") set(cxx_no_rtti_flags "-fno-rtti") + if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise") + else() + set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts") + endif() elseif (CMAKE_COMPILER_IS_GNUCXX) set(cxx_base_flags "-Wall -Wshadow -Wundef") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) From 029d3dddd4ba2788c5203490e63a24c02328bff8 Mon Sep 17 00:00:00 2001 From: niranjan Date: Wed, 24 May 2023 17:33:46 -0700 Subject: [PATCH 11/24] Disable some warnings for IntelLLVM on Windows. Use /fp:precise to override IntelLLVM's default of /fp:fast. This makes IsInf and IsNan work as expected by googletest. ``` [build]...\googletest\googlemock\test\gmock-function-mocker_test.cc(143,21): error: 'VoidReturning' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] [build] MOCK_METHOD(void, VoidReturning, (int n)); // NOLINT ``` ``` [build] ...\googletest\googlemock\test\gmock-function-mocker_test.cc(182,20): error: exception specification of overriding function is more lax than base version [-Werror,-Wmicrosoft-exception-spec] [build] MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE))); ``` ``` [build] ...\googletest\googletest\test\googletest-death-test-test.cc(209,5): error: unused function 'DieInCRTDebugElse12' [-Werror,-Wunused-function] [build] int DieInCRTDebugElse12(int* sideeffect) { [build] ^ ``` ``` [build] ...\googletest\googletest\test\gtest_unittest.cc(4096,7): error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable] [build] int n = 0; ``` --- googletest/cmake/internal_utils.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index f45a3be00..e7927a353 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -94,6 +94,9 @@ macro(config_compiler_and_linker) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(cxx_base_flags "${cxx_base_flags} -utf-8") endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(cxx_base_flags "${cxx_base_flags} /fp:precise -Wno-inconsistent-missing-override -Wno-microsoft-exception-spec -Wno-unused-function -Wno-unused-but-set-variable") + endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") set(cxx_base_flags "-Wall -Wshadow -Wconversion -Wundef") From ded275d75e0756e9659226f94bd4b8399af721d7 Mon Sep 17 00:00:00 2001 From: Pro3757 Date: Tue, 30 May 2023 13:50:23 +0530 Subject: [PATCH 12/24] fix README table --- README.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 10d1f86f1..c53a5ecee 100644 --- a/README.md +++ b/README.md @@ -55,37 +55,37 @@ More information about building GoogleTest can be found at | Feature | Description | | ---------------------------- | --------------------------------------------- | | xUnit test framework | Googletest is based on the | -: : [xUnit](https\://en.wikipedia.org/wiki/XUnit) : -: : testing framework, a popular architecture for : -: : unit testing : +| | [xUnit](https\://en.wikipedia.org/wiki/XUnit) | +| | testing framework, a popular architecture for | +| | unit testing | | Test discovery | Googletest automatically discovers and runs | -: : your tests, eliminating the need to manually : -: : register your tests : +| | your tests, eliminating the need to manually | +| | register your tests | | Rich set of assertions | Googletest provides a variety of assertions, | -: : such as equality, inequality, exceptions, and : -: : more, making it easy to test your code : +| | such as equality, inequality, exceptions, and | +| | more, making it easy to test your code | | User-defined assertions | You can define your own assertions with | -: : Googletest, making it simple to write tests : -: : that are specific to your code : +| | Googletest, making it simple to write tests | +| | that are specific to your code | | Death tests | Googletest supports death tests, which verify | -: : that your code exits in a certain way, making : -: : it useful for testing error-handling code : +| | that your code exits in a certain way, making | +| | it useful for testing error-handling code | | Fatal and non-fatal failures | You can specify whether a test failure should | -: : be treated as fatal or non-fatal with : -: : Googletest, allowing tests to continue : -: : running even if a failure occurs : +| | be treated as fatal or non-fatal with | +| | Googletest, allowing tests to continue | +| | running even if a failure occurs | | Value-parameterized tests | Googletest supports value-parameterized | -: : tests, which run multiple times with : -: : different input values, making it useful for : -: : testing functions that take different inputs : +| | tests, which run multiple times with | +| | different input values, making it useful for | +| | testing functions that take different inputs | | Type-parameterized tests | Googletest also supports type-parameterized | -: : tests, which run with different data types, : -: : making it useful for testing functions that : -: : work with different data types : +| | tests, which run with different data types, | +| | making it useful for testing functions that | +| | work with different data types | | Various options for running | Googletest provides many options for running | -: tests : tests, including running individual tests, : -: : running tests in a specific order, and : -: : running tests in parallel : +| tests | tests, including running individual tests, | +| | running tests in a specific order, and | +| | running tests in parallel | ## Supported Platforms From a7833a19bda5e3c7e0dc226875752514cf77645b Mon Sep 17 00:00:00 2001 From: Paul Wankadia Date: Wed, 31 May 2023 09:32:35 -0700 Subject: [PATCH 13/24] Update GoogleTest to RE2 release `2023-06-01`. Note that RE2 has taken a dependency on Abseil, so the `main` branch should be used from now on. The `abseil` branch will go away soon... PiperOrigin-RevId: 536737543 Change-Id: I0e595ee8e754b924881f997f286cdec3822763bf --- googletest_deps.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/googletest_deps.bzl b/googletest_deps.bzl index 65e56abb5..5e807d72d 100644 --- a/googletest_deps.bzl +++ b/googletest_deps.bzl @@ -7,10 +7,10 @@ def googletest_deps(): if not native.existing_rule("com_googlesource_code_re2"): http_archive( - name = "com_googlesource_code_re2", # 2022-12-21T14:29:10Z - sha256 = "b9ce3a51beebb38534d11d40f8928d40509b9e18a735f6a4a97ad3d014c87cb5", - strip_prefix = "re2-d0b1f8f2ecc2ea74956c7608b6f915175314ff0e", - urls = ["https://github.com/google/re2/archive/d0b1f8f2ecc2ea74956c7608b6f915175314ff0e.zip"], + name = "com_googlesource_code_re2", # 2023-06-01 + sha256 = "1726508efc93a50854c92e3f7ac66eb28f0e57652e413f11d7c1e28f97d997ba", + strip_prefix = "re2-03da4fc0857c285e3a26782f6bc8931c4c950df4", + urls = ["https://github.com/google/re2/archive/03da4fc0857c285e3a26782f6bc8931c4c950df4.zip"], ) if not native.existing_rule("com_google_absl"): From 04cf2989168a3f9218d463bea6f15f8ade2032fd Mon Sep 17 00:00:00 2001 From: Dino Radakovic Date: Wed, 31 May 2023 10:45:02 -0700 Subject: [PATCH 14/24] Provide example for setting C++ language standard in GoogleTest's Bazel quickstart and readme. An equivalent for CMake was merged in https://github.com/google/googletest/commit/aa99ce5a0db4215bb8e2cda3ee68b6b8d4896815 Fixes #4254 PiperOrigin-RevId: 536759641 Change-Id: I8400064a24e0d78f17a0720046f505efa1167b4f --- docs/quickstart-bazel.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md index 15c27a22e..4f693dbe7 100644 --- a/docs/quickstart-bazel.md +++ b/docs/quickstart-bazel.md @@ -105,10 +105,17 @@ file (`@com_google_googletest`). For more information about Bazel `BUILD` files, see the [Bazel C++ Tutorial](https://docs.bazel.build/versions/main/tutorial/cpp.html). +{: .callout .note} +NOTE: In the example below, we assume Clang or GCC and set `--cxxopt=-std=c++14` +to ensure that GoogleTest is compiled as C++14 instead of the compiler's default +setting (which could be C++11). For MSVC, the equivalent would be +`--cxxopt=/std:c++14`. See [Supported Platforms](platforms.md) for more details +on supported language versions. + Now you can build and run your test:
-my_workspace$ bazel test --test_output=all //:hello_test
+my_workspace$ bazel test --cxxopt=-std=c++14 --test_output=all //:hello_test
 INFO: Analyzed target //:hello_test (26 packages loaded, 362 targets configured).
 INFO: Found 1 test target...
 INFO: From Testing //:hello_test:

From 06f44bc951046150f1348598854b211afdcf37fc Mon Sep 17 00:00:00 2001
From: Dino Radakovic 
Date: Thu, 1 Jun 2023 07:28:00 -0700
Subject: [PATCH 15/24] Copy supported platforms from README onto
 https://google.github.io/googletest/platforms.html

PiperOrigin-RevId: 537016664
Change-Id: Ie62891a1061465a009b90feba0ccb91d85591160
---
 docs/platforms.md | 39 ++++++---------------------------------
 1 file changed, 6 insertions(+), 33 deletions(-)

diff --git a/docs/platforms.md b/docs/platforms.md
index eba6ef805..d35a7be05 100644
--- a/docs/platforms.md
+++ b/docs/platforms.md
@@ -1,35 +1,8 @@
 # Supported Platforms
 
-GoogleTest requires a codebase and compiler compliant with the C++11 standard or
-newer.
-
-The GoogleTest code is officially supported on the following platforms.
-Operating systems or tools not listed below are community-supported. For
-community-supported platforms, patches that do not complicate the code may be
-considered.
-
-If you notice any problems on your platform, please file an issue on the
-[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
-Pull requests containing fixes are welcome!
-
-### Operating systems
-
-*   Linux
-*   macOS
-*   Windows
-
-### Compilers
-
-*   gcc 5.0+
-*   clang 5.0+
-*   MSVC 2015+
-
-**macOS users:** Xcode 9.3+ provides clang 5.0+.
-
-### Build systems
-
-*   [Bazel](https://bazel.build/)
-*   [CMake](https://cmake.org/)
-
-Bazel is the build system used by the team internally and in tests. CMake is
-supported on a best-effort basis and by the community.
+GoogleTest follows Google's
+[Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
+See
+[this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
+for a list of currently supported versions compilers, platforms, and build
+tools.

From a5b94f6819d2c296958ae1f6b9130df99a37ec6d Mon Sep 17 00:00:00 2001
From: Niranjan Nilakantan 
Date: Thu, 1 Jun 2023 09:48:54 -0700
Subject: [PATCH 16/24] Ignore the .cache directory create by VSCode.

This is populated by the clangd language service provider.

Also ignore the cmake-variants.yaml file.
This can be created locally to select various build/test configurations.

Fixes #4266
---
 .gitignore | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.gitignore b/.gitignore
index f08cb72a3..fede02f65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,10 @@ Win32-Release/
 x64-Debug/
 x64-Release/
 
+# VSCode files
+.cache/
+cmake-variants.yaml
+
 # Ignore autoconf / automake files
 Makefile.in
 aclocal.m4

From 5ca3ab833168674ff417845941fc46691769ed36 Mon Sep 17 00:00:00 2001
From: Pro3757 
Date: Fri, 2 Jun 2023 00:58:00 +0530
Subject: [PATCH 17/24] change table to unordered list

---
 README.md | 66 +++++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/README.md b/README.md
index c53a5ecee..927222713 100644
--- a/README.md
+++ b/README.md
@@ -52,40 +52,38 @@ documentation. We recommend starting with the
 More information about building GoogleTest can be found at
 [googletest/README.md](googletest/README.md).
 
-| Feature                      | Description                                   |
-| ---------------------------- | --------------------------------------------- |
-| xUnit test framework         | Googletest is based on the                    |
-|                              | [xUnit](https\://en.wikipedia.org/wiki/XUnit) |
-|                              | testing framework, a popular architecture for |
-|                              | unit testing                                  |
-| Test discovery               | Googletest automatically discovers and runs   |
-|                              | your tests, eliminating the need to manually  |
-|                              | register your tests                           |
-| Rich set of assertions       | Googletest provides a variety of assertions,  |
-|                              | such as equality, inequality, exceptions, and |
-|                              | more, making it easy to test your code        |
-| User-defined assertions      | You can define your own assertions with       |
-|                              | Googletest, making it simple to write tests   |
-|                              | that are specific to your code                |
-| Death tests                  | Googletest supports death tests, which verify |
-|                              | that your code exits in a certain way, making |
-|                              | it useful for testing error-handling code     |
-| Fatal and non-fatal failures | You can specify whether a test failure should |
-|                              | be treated as fatal or non-fatal with         |
-|                              | Googletest, allowing tests to continue        |
-|                              | running even if a failure occurs              |
-| Value-parameterized tests    | Googletest supports value-parameterized       |
-|                              | tests, which run multiple times with          |
-|                              | different input values, making it useful for  |
-|                              | testing functions that take different inputs  |
-| Type-parameterized tests     | Googletest also supports type-parameterized   |
-|                              | tests, which run with different data types,   |
-|                              | making it useful for testing functions that   |
-|                              | work with different data types                |
-| Various options for running  | Googletest provides many options for running  |
-| tests                        | tests, including running individual tests,    |
-|                              | running tests in a specific order, and        |
-|                              | running tests in parallel                     |
+## Features
+*   xUnit test framework:  
+    Googletest is based on the [xUnit](https\://en.wikipedia.org/wiki/XUnit)
+    testing framework, a popular architecture for unit testing
+*   Test discovery:  
+    Googletest automatically discovers and runs your tests, eliminating the need
+    to manually register your tests
+*   Rich set of assertions:  
+    Googletest provides a variety of assertions, such as equality, inequality,
+    exceptions, and more, making it easy to test your code
+*   User-defined assertions:  
+    You can define your own assertions with Googletest, making it simple to
+    write tests that are specific to your code
+*   Death tests:  
+    Googletest supports death tests, which verify that your code exits in a
+    certain way, making it useful for testing error-handling code
+*   Fatal and non-fatal failures:  
+    You can specify whether a test failure should be treated as fatal or 
+    non-fatal with Googletest, allowing tests to continue running even if a
+    failure occurs
+*   Value-parameterized tests:  
+    Googletest supports value-parameterized tests, which run multiple times with
+    different input values, making it useful for testing functions that take
+    different inputs
+*   Type-parameterized tests:  
+    Googletest also supports type-parameterized tests, which run with different
+    data types, making it useful for testing functions that work with different
+    data types
+*   Various options for running tests:  
+    Googletest provides many options for running tests including running
+    individual tests, running tests in a specific order, and running tests in 
+    parallel
 
 ## Supported Platforms
 

From 001f281926c74a819e9266bb4ec525515ff39418 Mon Sep 17 00:00:00 2001
From: Joakim Plate 
Date: Fri, 2 Jun 2023 12:17:43 +0200
Subject: [PATCH 18/24] Check for file system for current directory

Check for current directory instead of death test to get original directory.

A port may support filesystems but not death tests.
---
 googletest/src/gtest-internal-inl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index 5ba557fe1..be821662c 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -672,7 +672,7 @@ class GTEST_API_ UnitTestImpl {
   void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
                    internal::TearDownTestSuiteFunc tear_down_tc,
                    TestInfo* test_info) {
-#ifdef GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_FILE_SYSTEM
     // In order to support thread-safe death tests, we need to
     // remember the original working directory when the test program
     // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as
@@ -685,7 +685,7 @@ class GTEST_API_ UnitTestImpl {
       GTEST_CHECK_(!original_working_dir_.IsEmpty())
           << "Failed to get the current working directory.";
     }
-#endif  // GTEST_HAS_DEATH_TEST
+#endif  // GTEST_HAS_FILE_SYSTEM
 
     GetTestSuite(test_info->test_suite_name(), test_info->type_param(),
                  set_up_tc, tear_down_tc)

From 65cfeca1a1eebca291b59395f79a60a4497d0f73 Mon Sep 17 00:00:00 2001
From: Abseil Team 
Date: Fri, 9 Jun 2023 11:28:44 -0700
Subject: [PATCH 19/24] internal g3doc documentation change.

PiperOrigin-RevId: 539134110
Change-Id: I28041f77e18bc67aa0ffabdc7205e350deed22c8
---
 docs/primer.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/primer.md b/docs/primer.md
index 31d63160e..c3aee3cc6 100644
--- a/docs/primer.md
+++ b/docs/primer.md
@@ -42,7 +42,7 @@ Since GoogleTest is based on the popular xUnit architecture, you'll feel right
 at home if you've used JUnit or PyUnit before. If not, it will take you about 10
 minutes to learn the basics and get started. So let's go!
 
-## Beware of the nomenclature
+## Beware of the Nomenclature
 
 {: .callout .note}
 *Note:* There might be some confusion arising from different definitions of the

From 4c7aee827e16aa338189b88f6e3aa6d3d927dba4 Mon Sep 17 00:00:00 2001
From: Dino Radakovic 
Date: Wed, 14 Jun 2023 06:40:34 -0700
Subject: [PATCH 20/24] Skip entire test suite with `GTEST_SKIP()` in
 `SetUpTestSuite`

Fixes #4273

PiperOrigin-RevId: 540254167
Change-Id: I2555740d10284223539035bf73f88554fcf73f8a
---
 googletest/src/gtest.cc                          |  3 ++-
 .../test/googletest-output-test-golden-lin.txt   | 16 +++++++++++++---
 googletest/test/googletest-output-test_.cc       |  6 ++++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index fb7512c1b..a88ac2557 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -3019,7 +3019,8 @@ void TestSuite::Run() {
   internal::HandleExceptionsInMethodIfSupported(
       this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()");
 
-  const bool skip_all = ad_hoc_test_result().Failed();
+  const bool skip_all =
+      ad_hoc_test_result().Failed() || ad_hoc_test_result().Skipped();
 
   start_timestamp_ = internal::GetTimeInMillis();
   internal::Timer timer;
diff --git a/googletest/test/googletest-output-test-golden-lin.txt b/googletest/test/googletest-output-test-golden-lin.txt
index 1f24fb791..6ddf822ff 100644
--- a/googletest/test/googletest-output-test-golden-lin.txt
+++ b/googletest/test/googletest-output-test-golden-lin.txt
@@ -12,7 +12,7 @@ Expected equality of these values:
   3
 Stack trace: (omitted)
 
-[==========] Running 89 tests from 42 test suites.
+[==========] Running 90 tests from 43 test suites.
 [----------] Global test environment set-up.
 FooEnvironment::SetUp() called.
 BarEnvironment::SetUp() called.
@@ -967,6 +967,15 @@ Stack trace: (omitted)
 googletest-output-test_.cc:#: Skipped
 
 [  SKIPPED ] TestSuiteThatFailsToSetUp.ShouldNotRun
+[----------] 1 test from TestSuiteThatSkipsInSetUp
+googletest-output-test_.cc:#: Skipped
+Skip entire test suite
+Stack trace: (omitted)
+
+[ RUN      ] TestSuiteThatSkipsInSetUp.ShouldNotRun
+googletest-output-test_.cc:#: Skipped
+
+[  SKIPPED ] TestSuiteThatSkipsInSetUp.ShouldNotRun
 [----------] 1 test from PrintingFailingParams/FailingParamTest
 [ RUN      ] PrintingFailingParams/FailingParamTest.Fails/0
 googletest-output-test_.cc:#: Failure
@@ -1043,10 +1052,11 @@ Failed
 Expected fatal failure.
 Stack trace: (omitted)
 
-[==========] 89 tests from 42 test suites ran.
+[==========] 90 tests from 43 test suites ran.
 [  PASSED  ] 31 tests.
-[  SKIPPED ] 1 test, listed below:
+[  SKIPPED ] 2 tests, listed below:
 [  SKIPPED ] TestSuiteThatFailsToSetUp.ShouldNotRun
+[  SKIPPED ] TestSuiteThatSkipsInSetUp.ShouldNotRun
 [  FAILED  ] 57 tests, listed below:
 [  FAILED  ] NonfatalFailureTest.EscapesStringOperands
 [  FAILED  ] NonfatalFailureTest.DiffForLongStrings
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index f1facf570..e3560c018 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -1007,6 +1007,12 @@ class TestSuiteThatFailsToSetUp : public testing::Test {
 };
 TEST_F(TestSuiteThatFailsToSetUp, ShouldNotRun) { std::abort(); }
 
+class TestSuiteThatSkipsInSetUp : public testing::Test {
+ public:
+  static void SetUpTestSuite() { GTEST_SKIP() << "Skip entire test suite"; }
+};
+TEST_F(TestSuiteThatSkipsInSetUp, ShouldNotRun) { std::abort(); }
+
 // The main function.
 //
 // The idea is to use Google Test to run all the tests we have defined (some

From 18fa6a4db32a30675c0b19bf72f8b5f693d21a23 Mon Sep 17 00:00:00 2001
From: Abseil Team 
Date: Thu, 15 Jun 2023 07:52:03 -0700
Subject: [PATCH 21/24] Allow clients to un-suppress output from gUnit
 EXPECT_EXIT tests.

This is useful for running individual tests in a separate process, which is
useful for testing e.g. flag changes which have a process-global effect.

PiperOrigin-RevId: 540580573
Change-Id: I18a5d24d79425a9d595be3369efc44e2f655f6f8
---
 googletest/include/gtest/gtest.h   | 5 ++++-
 googletest/src/gtest-death-test.cc | 2 +-
 googletest/src/gtest.cc            | 6 +++---
 googletest/test/gtest_unittest.cc  | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 841250349..86777c854 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -1055,6 +1055,10 @@ class GTEST_API_ TestEventListeners {
     return default_xml_generator_;
   }
 
+  // Controls whether events will be forwarded by the repeater to the
+  // listeners in the list.
+  void SuppressEventForwarding(bool);
+
  private:
   friend class TestSuite;
   friend class TestInfo;
@@ -1084,7 +1088,6 @@ class GTEST_API_ TestEventListeners {
   // Controls whether events will be forwarded by the repeater to the
   // listeners in the list.
   bool EventForwardingEnabled() const;
-  void SuppressEventForwarding();
 
   // The actual list of listeners.
   internal::TestEventRepeater* repeater_;
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index 4cf78e71a..0eb6e38b2 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -1128,7 +1128,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
     LogToStderr();
     // Event forwarding to the listeners of event listener API mush be shut
     // down in death test subprocesses.
-    GetUnitTestImpl()->listeners()->SuppressEventForwarding();
+    GetUnitTestImpl()->listeners()->SuppressEventForwarding(true);
     g_in_fast_death_test_child = true;
     return EXECUTE_TEST;
   } else {
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index a88ac2557..d9fd27709 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -5156,8 +5156,8 @@ bool TestEventListeners::EventForwardingEnabled() const {
   return repeater_->forwarding_enabled();
 }
 
-void TestEventListeners::SuppressEventForwarding() {
-  repeater_->set_forwarding_enabled(false);
+void TestEventListeners::SuppressEventForwarding(bool suppress) {
+  repeater_->set_forwarding_enabled(!suppress);
 }
 
 // class UnitTest
@@ -5635,7 +5635,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
 // subprocess. Must not be called before InitGoogleTest.
 void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
   if (internal_run_death_test_flag_ != nullptr)
-    listeners()->SuppressEventForwarding();
+    listeners()->SuppressEventForwarding(true);
 }
 #endif  // GTEST_HAS_DEATH_TEST
 
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 77d968a72..dd049a00d 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -173,7 +173,7 @@ class TestEventListenersAccessor {
   }
 
   static void SuppressEventForwarding(TestEventListeners* listeners) {
-    listeners->SuppressEventForwarding();
+    listeners->SuppressEventForwarding(true);
   }
 };
 

From 148b327ffa6f7f97cffd1606342a136cf497210b Mon Sep 17 00:00:00 2001
From: Kasra Hashemi <73937934+zencatalyst@users.noreply.github.com>
Date: Fri, 16 Jun 2023 13:59:16 +0330
Subject: [PATCH 22/24] Update README.md

Fixed punctuation issues
---
 README.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index ef0c288d5..443e02069 100644
--- a/README.md
+++ b/README.md
@@ -27,8 +27,8 @@ The 1.13.x branch requires at least C++14.
 #### Continuous Integration
 
 We use Google's internal systems for continuous integration. \
-GitHub Actions were added for the convenience of open source contributors. They
-are exclusively maintained by the open source community and not used by the
+GitHub Actions were added for the convenience of open-source contributors. They
+are exclusively maintained by the open-source community and not used by the
 GoogleTest team.
 
 #### Coming Soon
@@ -83,7 +83,7 @@ More information about building GoogleTest can be found at
     data types
 *   Various options for running tests: \
     Googletest provides many options for running tests including running
-    individual tests, running tests in a specific order, and running tests in
+    individual tests, running tests in a specific order and running tests in
     parallel
 
 ## Supported Platforms
@@ -92,7 +92,7 @@ GoogleTest follows Google's
 [Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
 See
 [this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
-for a list of currently supported versions compilers, platforms, and build
+for a list of currently supported versions of compilers, platforms, and build
 tools.
 
 ## Who Is Using GoogleTest?

From 124bc587f0f6157f0bf49a05deb68956db307732 Mon Sep 17 00:00:00 2001
From: Ryan Schmidt 
Date: Mon, 19 Jun 2023 06:18:12 -0500
Subject: [PATCH 23/24] Change C++11 requirement to C++14

Version 1.13.x and later require C++14.

Also fix missing closing backtick.
---
 googletest/README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/googletest/README.md b/googletest/README.md
index 4cad12f75..6bbd7f875 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -124,10 +124,10 @@ match the project in which it is included.
 
 #### C++ Standard Version
 
-An environment that supports C++11 is required in order to successfully build
+An environment that supports C++14 is required in order to successfully build
 GoogleTest. One way to ensure this is to specify the standard in the top-level
-project, for example by using the `set(CMAKE_CXX_STANDARD 11)` command along
-with `set(CMAKE_CXX_STANDARD_REQUIRED ON). If this is not feasible, for example
+project, for example by using the `set(CMAKE_CXX_STANDARD 14)` command along
+with `set(CMAKE_CXX_STANDARD_REQUIRED ON)`. If this is not feasible, for example
 in a C project using GoogleTest for validation, then it can be specified by
 adding it to the options for cmake via the`-DCMAKE_CXX_FLAGS` option.
 

From 4fed5f285030085b096c930ff03e42c7814739b2 Mon Sep 17 00:00:00 2001
From: Juan Ramos 
Date: Mon, 19 Jun 2023 11:21:44 -0600
Subject: [PATCH 24/24] cmake: Raise min to 3.6

From the CMake 3.27 release notes:
Compatibility with versions of CMake older than 3.5 is now
deprecated and will be removed from a future version. Calls to
cmake_minimum_required() or cmake_policy() that set the policy
version to an older value now issue a deprecation diagnostic.

This PR also removes manually setting policy CMP0048. This is
redundant since the CMake min is already 3.X
---
 CMakeLists.txt            |  6 +-----
 docs/pkgconfig.md         | 14 +++++---------
 googlemock/CMakeLists.txt |  3 +--
 googletest/CMakeLists.txt |  3 +--
 4 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6af414371..33a6c6ff4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,7 @@
 # Note: CMake support is community-based. The maintainers do not use CMake
 # internally.
 
-cmake_minimum_required(VERSION 3.5)
-
-if (POLICY CMP0048)
-  cmake_policy(SET CMP0048 NEW)
-endif (POLICY CMP0048)
+cmake_minimum_required(VERSION 3.6)
 
 if (POLICY CMP0069)
   cmake_policy(SET CMP0069 NEW)
diff --git a/docs/pkgconfig.md b/docs/pkgconfig.md
index 18a2546a3..bf05d5931 100644
--- a/docs/pkgconfig.md
+++ b/docs/pkgconfig.md
@@ -19,19 +19,15 @@ examples here we assume you want to compile the sample
 Using `pkg-config` in CMake is fairly easy:
 
 ```cmake
-cmake_minimum_required(VERSION 3.0)
-
-cmake_policy(SET CMP0048 NEW)
-project(my_gtest_pkgconfig VERSION 0.0.1 LANGUAGES CXX)
-
 find_package(PkgConfig)
 pkg_search_module(GTEST REQUIRED gtest_main)
 
-add_executable(testapp samples/sample3_unittest.cc)
-target_link_libraries(testapp ${GTEST_LDFLAGS})
-target_compile_options(testapp PUBLIC ${GTEST_CFLAGS})
+add_executable(testapp)
+target_sources(testapp PRIVATE samples/sample3_unittest.cc)
+target_link_libraries(testapp PRIVATE ${GTEST_LDFLAGS})
+target_compile_options(testapp PRIVATE ${GTEST_CFLAGS})
 
-include(CTest)
+enable_testing()
 add_test(first_and_only_test testapp)
 ```
 
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index 5c1f0dafe..444c5ae80 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -36,8 +36,7 @@ endif()
 # as ${gmock_SOURCE_DIR} and to the root binary directory as
 # ${gmock_BINARY_DIR}.
 # Language "C" is required for find_package(Threads).
-cmake_minimum_required(VERSION 3.5)
-cmake_policy(SET CMP0048 NEW)
+cmake_minimum_required(VERSION 3.6)
 project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
 
 if (COMMAND set_up_hermetic_build)
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index d06c14797..efc2c3cbe 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -46,8 +46,7 @@ endif()
 
 # Project version:
 
-cmake_minimum_required(VERSION 3.5)
-cmake_policy(SET CMP0048 NEW)
+cmake_minimum_required(VERSION 3.6)
 project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
 
 if (POLICY CMP0063) # Visibility