From 7da4a4114ad2bf5ae61460e0c02ba35fc323fc9d Mon Sep 17 00:00:00 2001 From: Alecto Irene Perez Date: Sat, 26 Mar 2022 21:52:05 -0600 Subject: [PATCH 01/28] Fix quickstart-cmake documentation Signed-off-by: Alecto Irene Perez --- docs/quickstart-cmake.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/quickstart-cmake.md b/docs/quickstart-cmake.md index 420f1d3a..9080580d 100644 --- a/docs/quickstart-cmake.md +++ b/docs/quickstart-cmake.md @@ -58,7 +58,8 @@ set(CMAKE_CXX_STANDARD 11) include(FetchContent) FetchContent_Declare( googletest - URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.11.0 ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) @@ -108,7 +109,7 @@ add_executable( ) target_link_libraries( hello_test - gtest_main + GTest::gtest_main ) include(GoogleTest) From 6f3f9a9e617c0571356f74821944b13f54233f1c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 May 2022 15:51:33 -0400 Subject: [PATCH 02/28] set -utf-8 flag only for real MSVC compilers. E.g. not Intel's icx.exe --- googletest/cmake/internal_utils.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 5a34c07a..b5bff9ad 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -82,7 +82,9 @@ macro(config_compiler_and_linker) # http://stackoverflow.com/questions/3232669 explains the issue. set(cxx_base_flags "${cxx_base_flags} -wd4702") # Ensure MSVC treats source files as UTF-8 encoded. - set(cxx_base_flags "${cxx_base_flags} -utf-8") + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(cxx_base_flags "${cxx_base_flags} -utf-8") + endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(cxx_base_flags "-Wall -Wshadow -Wconversion") set(cxx_exception_flags "-fexceptions") From 410e5f9e04609a8dd6b6fc794ce18f060fca35ec Mon Sep 17 00:00:00 2001 From: Gaspard Petit Date: Mon, 30 May 2022 11:04:54 -0400 Subject: [PATCH 03/28] Fix "unused variable" warning Fix "unused variable" warning when GTEST_HAS_STREAM_REDIRECTION is set to false in gtest-port.cc --- googletest/src/gtest-port.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 73a1115a..7cf6d413 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -90,6 +90,7 @@ namespace testing { namespace internal { +#if GTEST_HAS_STREAM_REDIRECTION #if defined(_MSC_VER) || defined(__BORLANDC__) // MSVC and C++Builder do not provide a definition of STDERR_FILENO. const int kStdOutFileno = 1; @@ -98,6 +99,7 @@ const int kStdErrFileno = 2; const int kStdOutFileno = STDOUT_FILENO; const int kStdErrFileno = STDERR_FILENO; #endif // _MSC_VER +#endif // GTEST_HAS_STREAM_REDIRECTION #if GTEST_OS_LINUX || GTEST_OS_GNU_HURD From 59006287cd4f8c239eaa0f23852eef2b57d93da3 Mon Sep 17 00:00:00 2001 From: Gaspard Petit Date: Mon, 30 May 2022 13:34:17 -0400 Subject: [PATCH 04/28] Simplify ColoredPrintf to rely on ShouldUseColor Use ShouldUseColor to set use_color instead of having a separate check for the windows mobile cases; these cases are now moved directly to `DoIsATTY` --- googletest/include/gtest/internal/gtest-port.h | 3 ++- googletest/src/gtest.cc | 8 +------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 7162e6e1..e52d8a78 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1965,7 +1965,8 @@ inline int StrCaseCmp(const char* s1, const char* s2) { } inline char* StrDup(const char* src) { return strdup(src); } #else // !__BORLANDC__ -#if GTEST_OS_WINDOWS_MOBILE +#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \ + GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM) inline int DoIsATTY(int /* fd */) { return 0; } #else inline int DoIsATTY(int fd) { return _isatty(fd); } diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 1acad59a..54aae939 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3278,14 +3278,8 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) { va_list args; va_start(args, fmt); -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \ - GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM) - const bool use_color = AlwaysFalse(); -#else - static const bool in_color_mode = - ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); + static const bool in_color_mode = ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); const bool use_color = in_color_mode && (color != GTestColor::kDefault); -#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS if (!use_color) { vprintf(fmt, args); From a86777edf9244c48350b50f0a636c58fc4f0c603 Mon Sep 17 00:00:00 2001 From: Gaspard Petit Date: Tue, 31 May 2022 17:35:34 -0400 Subject: [PATCH 05/28] Fix for undefined symbol: testing::internal::Random::kMaxRange --- googletest/src/gtest.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 1acad59a..e268230a 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -372,6 +372,8 @@ GTEST_DEFINE_string_( namespace testing { namespace internal { +const uint32_t Random::kMaxRange; + // Generates a random number from [0, range), using a Linear // Congruential Generator (LCG). Crashes if 'range' is 0 or greater // than kMaxRange. From fe735a698657a7fffe6b5062c6bf5b13b6a6950c Mon Sep 17 00:00:00 2001 From: Gaspard Petit Date: Sat, 11 Jun 2022 10:26:41 -0400 Subject: [PATCH 06/28] Move declaration of kStdOutFileNo and kStdErrFileno Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice --- googletest/src/gtest-port.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 7cf6d413..cf66d9e8 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -90,17 +90,6 @@ namespace testing { namespace internal { -#if GTEST_HAS_STREAM_REDIRECTION -#if defined(_MSC_VER) || defined(__BORLANDC__) -// MSVC and C++Builder do not provide a definition of STDERR_FILENO. -const int kStdOutFileno = 1; -const int kStdErrFileno = 2; -#else -const int kStdOutFileno = STDOUT_FILENO; -const int kStdErrFileno = STDERR_FILENO; -#endif // _MSC_VER -#endif // GTEST_HAS_STREAM_REDIRECTION - #if GTEST_OS_LINUX || GTEST_OS_GNU_HURD namespace { @@ -1179,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) { return content; } +#if defined(_MSC_VER) || defined(__BORLANDC__) +// MSVC and C++Builder do not provide a definition of STDERR_FILENO. +const int kStdOutFileno = 1; +const int kStdErrFileno = 2; +#else +const int kStdOutFileno = STDOUT_FILENO; +const int kStdErrFileno = STDERR_FILENO; +#endif // _MSC_VER + // Starts capturing stdout. void CaptureStdout() { CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout); From 8b521aa43aa570fb9a106099f12427ccff2a79cb Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 13 Jun 2022 12:50:53 -0700 Subject: [PATCH 07/28] gmock_cook_book.md: Delete superfluous statement from 2014. PiperOrigin-RevId: 454677195 Change-Id: I7a1419e22d617db41a5c310bc6f6158ba4cec1ab --- docs/gmock_cook_book.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index b6abffae..8a11d864 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -392,8 +392,7 @@ Old macros and their new equivalents: If a mock method has no `EXPECT_CALL` spec but is called, we say that it's an "uninteresting call", and the default action (which can be specified using `ON_CALL()`) of the method will be taken. Currently, an uninteresting call will -also by default cause gMock to print a warning. (In the future, we might remove -this warning by default.) +also by default cause gMock to print a warning. However, sometimes you may want to ignore these uninteresting calls, and sometimes you may want to treat them as errors. gMock lets you make the decision From 86add13493e5c881d7e4ba77fb91c1f57752b3a4 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 16 Jun 2022 13:17:57 -0700 Subject: [PATCH 08/28] Disable warning C4251 around refactored code PiperOrigin-RevId: 455452553 Change-Id: I1dc3772ae61daf6d2d39484a0b1aad7eb0134525 --- googletest/include/gtest/gtest-assertion-result.h | 5 +++++ googletest/include/gtest/internal/gtest-port.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/googletest/include/gtest/gtest-assertion-result.h b/googletest/include/gtest/gtest-assertion-result.h index e020c489..addbb59c 100644 --- a/googletest/include/gtest/gtest-assertion-result.h +++ b/googletest/include/gtest/gtest-assertion-result.h @@ -46,6 +46,9 @@ #include "gtest/gtest-message.h" #include "gtest/internal/gtest-port.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // A class for indicating whether an assertion was successful. When @@ -229,4 +232,6 @@ GTEST_API_ AssertionResult AssertionFailure(const Message& msg); } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_ diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index e52d8a78..0003d276 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1200,6 +1200,9 @@ class GTEST_API_ AutoHandle { // Nothing to do here. #else +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. @@ -1233,6 +1236,7 @@ class GTEST_API_ Notification { std::condition_variable cv_; bool notified_; }; +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 #endif // GTEST_HAS_NOTIFICATION_ // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD From 7df7853ea02371f6d24ccf4a0cf9e16553d23d05 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Tue, 21 Jun 2022 12:27:03 -0700 Subject: [PATCH 09/28] Update GCC floor container used by CI to fix the Bazel cache error PiperOrigin-RevId: 456323043 Change-Id: I86e3d52b72b51c2d4e96f536daa7f84a52c598f5 --- ci/linux-presubmit.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh index 8d00bcaa..0ee56704 100644 --- a/ci/linux-presubmit.sh +++ b/ci/linux-presubmit.sh @@ -32,7 +32,7 @@ set -euox pipefail readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220217" -readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20210617" +readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20220621" if [[ -z ${GTEST_ROOT:-} ]]; then GTEST_ROOT="$(realpath $(dirname ${0})/..)" @@ -78,6 +78,7 @@ time docker run \ --copt="-Werror" \ --copt="-Wuninitialized" \ --copt="-Wno-error=pragmas" \ + --distdir="/bazel-distdir" \ --keep_going \ --show_timestamps \ --test_output=errors From 15460959cbbfa20e66ef0b5ab497367e47fc0a04 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Wed, 22 Jun 2022 09:23:04 -0700 Subject: [PATCH 10/28] Update versions of WORKSPACE dependencies PiperOrigin-RevId: 456532035 Change-Id: I60fa4d4e7827516d317ce893377d1f72e49c6a2f --- WORKSPACE | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 318b9088..4d7b3988 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,25 +4,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "com_google_absl", - sha256 = "f88c0030547281e8283ff183db61564ff08d3322a8c2e2de4c40e38c03c69aea", - strip_prefix = "abseil-cpp-c27ab06897f330267bed99061ed3e523e2606bf1", - urls = ["https://github.com/abseil/abseil-cpp/archive/c27ab06897f330267bed99061ed3e523e2606bf1.zip"], # 2022-04-18T19:51:27Z + sha256 = "1a1745b5ee81392f5ea4371a4ca41e55d446eeaee122903b2eaffbd8a3b67a2b", + strip_prefix = "abseil-cpp-01cc6567cff77738e416a7ddc17de2d435a780ce", + urls = ["https://github.com/abseil/abseil-cpp/archive/01cc6567cff77738e416a7ddc17de2d435a780ce.zip"], # 2022-06-21T19:28:27Z ) # Note this must use a commit from the `abseil` branch of the RE2 project. # https://github.com/google/re2/tree/abseil http_archive( name = "com_googlesource_code_re2", - sha256 = "906d0df8ff48f8d3a00a808827f009a840190f404559f649cb8e4d7143255ef9", - strip_prefix = "re2-a276a8c738735a0fe45a6ee590fe2df69bcf4502", - urls = ["https://github.com/google/re2/archive/a276a8c738735a0fe45a6ee590fe2df69bcf4502.zip"], # 2022-04-08 + sha256 = "0a890c2aa0bb05b2ce906a15efb520d0f5ad4c7d37b8db959c43772802991887", + strip_prefix = "re2-a427f10b9fb4622dd6d8643032600aa1b50fbd12", + urls = ["https://github.com/google/re2/archive/a427f10b9fb4622dd6d8643032600aa1b50fbd12.zip"], # 2022-06-09 ) http_archive( name = "rules_python", - sha256 = "98b3c592faea9636ac8444bfd9de7f3fb4c60590932d6e6ac5946e3f8dbd5ff6", - strip_prefix = "rules_python-ed6cc8f2c3692a6a7f013ff8bc185ba77eb9b4d2", - urls = ["https://github.com/bazelbuild/rules_python/archive/ed6cc8f2c3692a6a7f013ff8bc185ba77eb9b4d2.zip"], # 2021-05-17T00:24:16Z + sha256 = "0b460f17771258341528753b1679335b629d1d25e3af28eda47d009c103a6e15", + strip_prefix = "rules_python-aef17ad72919d184e5edb7abf61509eb78e57eda", + urls = ["https://github.com/bazelbuild/rules_python/archive/aef17ad72919d184e5edb7abf61509eb78e57eda.zip"], # 2022-06-21T23:44:47Z ) http_archive( @@ -33,7 +33,7 @@ http_archive( http_archive( name = "platforms", - sha256 = "b601beaf841244de5c5a50d2b2eddd34839788000fa1be4260ce6603ca0d8eb7", - strip_prefix = "platforms-98939346da932eef0b54cf808622f5bb0928f00b", - urls = ["https://github.com/bazelbuild/platforms/archive/98939346da932eef0b54cf808622f5bb0928f00b.zip"], + sha256 = "a879ea428c6d56ab0ec18224f976515948822451473a80d06c2e50af0bbe5121", + strip_prefix = "platforms-da5541f26b7de1dc8e04c075c99df5351742a4a2", + urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27 ) From 5376968f6948923e2411081fd9372e71a59d8e77 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 23 Jun 2022 12:18:22 -0700 Subject: [PATCH 11/28] Update README.md for release 1.12.0 PiperOrigin-RevId: 456833286 Change-Id: Iefcc6a71f5da9bb710f112b668cddcd1683a10ae --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30edaecf..4c0f0c4c 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository. -#### Release 1.11.0 +#### Release 1.12.0 -[Release 1.11.0](https://github.com/google/googletest/releases/tag/release-1.11.0) +[Release 1.12.0](https://github.com/google/googletest/releases/tag/release-1.12.0) is now available. #### Coming Soon From b9d2e1f62f3d93c1c3197900ba7170fa5177ad23 Mon Sep 17 00:00:00 2001 From: Julian Arkenau Date: Sat, 25 Jun 2022 14:41:57 +0200 Subject: [PATCH 12/28] docs: update googletest README for release 1.12.0 --- googletest/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/README.md b/googletest/README.md index d26b309e..8760d13e 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -25,7 +25,7 @@ When building GoogleTest as a standalone project, the typical workflow starts with ``` -git clone https://github.com/google/googletest.git -b release-1.11.0 +git clone https://github.com/google/googletest.git -b release-1.12.0 cd googletest # Main directory of the cloned repository. mkdir build # Create a directory to hold the build output. cd build @@ -94,7 +94,7 @@ include(FetchContent) FetchContent_Declare( googletest # Specify the commit you depend on and update it regularly. - URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip + URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) From 9406a60c7839052e4944ea4dbc8344762a89f9bd Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 27 Jun 2022 13:15:39 -0700 Subject: [PATCH 13/28] Mark internal-only function as having internal linkage. PiperOrigin-RevId: 457550818 Change-Id: I9046801b64ce4581d742d650451332fd56489632 --- googlemock/src/gmock-spec-builders.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 658ad3fa..783c3124 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -435,7 +435,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() return expectations_met; } -CallReaction intToCallReaction(int mock_behavior) { +static CallReaction intToCallReaction(int mock_behavior) { if (mock_behavior >= kAllow && mock_behavior <= kFail) { return static_cast(mock_behavior); } From d9335595b4cd73c8450c18e4dbf1ee0801c23c2e Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 29 Jun 2022 11:10:19 -0700 Subject: [PATCH 14/28] Add support of 17-member structs to gmock UnpackStructImpl. PiperOrigin-RevId: 458018249 Change-Id: I7df8f75ef5b5a6478e7301f959c221810ff9f0b3 --- googlemock/include/gmock/gmock-matchers.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 62829011..3c8cc32e 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -3235,6 +3235,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<16>, char) { const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] = t; return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); } +template +auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) { + const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t; + return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); +} #endif // defined(__cpp_structured_bindings) template From 219af0d535635f173e58d7e8ef197b0bc48b878a Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 30 Jun 2022 07:09:49 -0700 Subject: [PATCH 15/28] Update version number in CMakeLists.txt Note that this is 1.12.1 as there will be a patch release to fix this PiperOrigin-RevId: 458216994 Change-Id: Ibca52a8db22ed06cb1a1adc4832be67fce69459a --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4daf35b5..102e28cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ if (POLICY CMP0077) endif (POLICY CMP0077) project(googletest-distribution) -set(GOOGLETEST_VERSION 1.11.0) +set(GOOGLETEST_VERSION 1.12.1) if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) set(CMAKE_CXX_EXTENSIONS OFF) From 96f51426e4c776a71d0a446c1e4f4c7a5ea921df Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 30 Jun 2022 09:53:12 -0700 Subject: [PATCH 16/28] Remove support for C++11 v1.12.x is the last branch to support C++11 Future releases will require at least C++14 PiperOrigin-RevId: 458250106 Change-Id: Ibee2248649ff3c13daaa179135887848bf730f3f --- README.md | 9 ++++++--- ci/linux-presubmit.sh | 4 ++-- ci/macos-presubmit.sh | 5 +++-- docs/quickstart-bazel.md | 2 +- docs/quickstart-cmake.md | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4c0f0c4c..745f5c26 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,14 @@ Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository. -#### Release 1.12.0 +#### Release 1.12.1 -[Release 1.12.0](https://github.com/google/googletest/releases/tag/release-1.12.0) +[Release 1.12.1](https://github.com/google/googletest/releases/tag/release-1.12.1) is now available. +The 1.12.x branch will be the last to support C++11. Future releases will +require at least C++14. + #### Coming Soon * We are planning to take a dependency on @@ -56,7 +59,7 @@ More information about building GoogleTest can be found at ## Supported Platforms -GoogleTest requires a codebase and compiler compliant with the C++11 standard or +GoogleTest requires a codebase and compiler compliant with the C++14 standard or newer. The GoogleTest code is officially supported on the following platforms. diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh index 0ee56704..09abdc87 100644 --- a/ci/linux-presubmit.sh +++ b/ci/linux-presubmit.sh @@ -39,7 +39,7 @@ if [[ -z ${GTEST_ROOT:-} ]]; then fi if [[ -z ${STD:-} ]]; then - STD="c++11 c++14 c++17 c++20" + STD="c++14 c++17 c++20" fi # Test the CMake build @@ -55,7 +55,7 @@ for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do ${LINUX_LATEST_CONTAINER} \ /bin/bash -c " cmake /src \ - -DCMAKE_CXX_STANDARD=11 \ + -DCMAKE_CXX_STANDARD=14 \ -Dgtest_build_samples=ON \ -Dgtest_build_tests=ON \ -Dgmock_build_tests=ON \ diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh index d6423faa..3b711da5 100644 --- a/ci/macos-presubmit.sh +++ b/ci/macos-presubmit.sh @@ -40,7 +40,7 @@ for cmake_off_on in OFF ON; do BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX) cd ${BUILD_DIR} time cmake ${GTEST_ROOT} \ - -DCMAKE_CXX_STANDARD=11 \ + -DCMAKE_CXX_STANDARD=14 \ -Dgtest_build_samples=ON \ -Dgtest_build_tests=ON \ -Dgmock_build_tests=ON \ @@ -53,7 +53,7 @@ done # Test the Bazel build # If we are running on Kokoro, check for a versioned Bazel binary. -KOKORO_GFILE_BAZEL_BIN="bazel-3.7.0-darwin-x86_64" +KOKORO_GFILE_BAZEL_BIN="bazel-5.1.1-darwin-x86_64" if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}" chmod +x ${BAZEL_BIN} @@ -66,6 +66,7 @@ for absl in 0 1; do ${BAZEL_BIN} test ... \ --copt="-Wall" \ --copt="-Werror" \ + --cxxopt="-std=c++14" \ --define="absl=${absl}" \ --keep_going \ --show_timestamps \ diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md index 5d6e9c68..c187e729 100644 --- a/docs/quickstart-bazel.md +++ b/docs/quickstart-bazel.md @@ -9,7 +9,7 @@ we recommend this tutorial as a starting point. To complete this tutorial, you'll need: * A compatible operating system (e.g. Linux, macOS, Windows). -* A compatible C++ compiler that supports at least C++11. +* A compatible C++ compiler that supports at least C++14. * [Bazel](https://bazel.build/), the preferred build system used by the GoogleTest team. diff --git a/docs/quickstart-cmake.md b/docs/quickstart-cmake.md index 420f1d3a..fb72f384 100644 --- a/docs/quickstart-cmake.md +++ b/docs/quickstart-cmake.md @@ -10,7 +10,7 @@ this tutorial as a starting point. If your project uses Bazel, see the To complete this tutorial, you'll need: * A compatible operating system (e.g. Linux, macOS, Windows). -* A compatible C++ compiler that supports at least C++11. +* A compatible C++ compiler that supports at least C++14. * [CMake](https://cmake.org/) and a compatible build tool for building the project. * Compatible build tools include @@ -52,8 +52,8 @@ To do this, in your project directory (`my_project`), create a file named cmake_minimum_required(VERSION 3.14) project(my_project) -# GoogleTest requires at least C++11 -set(CMAKE_CXX_STANDARD 11) +# GoogleTest requires at least C++14 +set(CMAKE_CXX_STANDARD 14) include(FetchContent) FetchContent_Declare( From 2cf9987ce3510de36640dcabd3d53db2c09312f6 Mon Sep 17 00:00:00 2001 From: yutotnh <57719497+yutotnh@users.noreply.github.com> Date: Fri, 1 Jul 2022 18:32:49 +0900 Subject: [PATCH 17/28] fix: some typos in comment --- googlemock/test/gmock-actions_test.cc | 4 ++-- googlemock/test/gmock-matchers-misc_test.cc | 2 +- googletest/include/gtest/internal/gtest-internal.h | 2 +- googletest/src/gtest-internal-inl.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 215495ed..e5a7ae13 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -466,7 +466,7 @@ TEST(DefaultValueOfReferenceTest, IsInitiallyUnset) { EXPECT_FALSE(DefaultValue::IsSet()); } -// Tests that DefaultValue::Exists is false initiallly. +// Tests that DefaultValue::Exists is false initially. TEST(DefaultValueOfReferenceTest, IsInitiallyNotExisting) { EXPECT_FALSE(DefaultValue::Exists()); EXPECT_FALSE(DefaultValue::Exists()); @@ -807,7 +807,7 @@ TEST(ReturnTest, MoveOnlyResultType) { ""); } -// Tests that Return(v) is covaraint. +// Tests that Return(v) is covariant. struct Base { bool operator==(const Base&) { return true; } diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc index c68431c1..53f4962b 100644 --- a/googlemock/test/gmock-matchers-misc_test.cc +++ b/googlemock/test/gmock-matchers-misc_test.cc @@ -1561,7 +1561,7 @@ TEST(AnyOfArrayTest, Matchers) { } TEST_P(AnyOfArrayTestP, ExplainsMatchResultCorrectly) { - // AnyOfArray and AllOfArry use the same underlying template-template, + // AnyOfArray and AllOfArray use the same underlying template-template, // thus it is sufficient to test one here. const std::vector v0{}; const std::vector v1{1}; diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 9b04e4c8..4d919458 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -461,7 +461,7 @@ class TestFactoryBase { TestFactoryBase& operator=(const TestFactoryBase&) = delete; }; -// This class provides implementation of TeastFactoryBase interface. +// This class provides implementation of TestFactoryBase interface. // It is used in TEST and TEST_F macros. template class TestFactoryImpl : public TestFactoryBase { diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 0b9e929c..ffe5322f 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -507,9 +507,9 @@ class GTEST_API_ UnitTestImpl { virtual ~UnitTestImpl(); // There are two different ways to register your own TestPartResultReporter. - // You can register your own repoter to listen either only for test results + // You can register your own reporter to listen either only for test results // from the current thread or for results from all threads. - // By default, each per-thread test result repoter just passes a new + // By default, each per-thread test result reporter just passes a new // TestPartResult to the global test result reporter, which registers the // test part result for the currently running test. From 6c57d607c7d75df2d87b1e349f9bef054499c1bf Mon Sep 17 00:00:00 2001 From: yutotnh <57719497+yutotnh@users.noreply.github.com> Date: Fri, 1 Jul 2022 18:33:00 +0900 Subject: [PATCH 18/28] fix: typo in test name --- googlemock/test/gmock-spec-builders_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 122d5b94..bb0773b5 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -1064,7 +1064,7 @@ TEST(UnexpectedCallTest, UnmatchedArguments) { // Tests that Google Mock explains that an expectation with // unsatisfied pre-requisites doesn't match the call. -TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) { +TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) { Sequence s1, s2; MockB b; EXPECT_CALL(b, DoB(1)).InSequence(s1); From 644a4bea02c478f73325b9125a2b6409f3c55420 Mon Sep 17 00:00:00 2001 From: yutotnh <57719497+yutotnh@users.noreply.github.com> Date: Fri, 1 Jul 2022 18:33:14 +0900 Subject: [PATCH 19/28] fix: some typos in source --- googletest/src/gtest-internal-inl.h | 2 +- googletest/src/gtest.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index ffe5322f..8c650e0c 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -850,7 +850,7 @@ class GTEST_API_ UnitTestImpl { default_per_thread_test_part_result_reporter_; // Points to (but doesn't own) the global test part result reporter. - TestPartResultReporterInterface* global_test_part_result_repoter_; + TestPartResultReporterInterface* global_test_part_result_reporter_; // Protects read and write access to global_test_part_result_reporter_. internal::Mutex global_test_part_result_reporter_mutex_; diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 6f31dd22..6beac089 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -1008,14 +1008,14 @@ void DefaultPerThreadTestPartResultReporter::ReportTestPartResult( TestPartResultReporterInterface* UnitTestImpl::GetGlobalTestPartResultReporter() { internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - return global_test_part_result_repoter_; + return global_test_part_result_reporter_; } // Sets the global test part result reporter. void UnitTestImpl::SetGlobalTestPartResultReporter( TestPartResultReporterInterface* reporter) { internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - global_test_part_result_repoter_ = reporter; + global_test_part_result_reporter_ = reporter; } // Returns the test part result reporter for the current thread. @@ -5516,7 +5516,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */) default_global_test_part_result_reporter_(this), default_per_thread_test_part_result_reporter_(this), - GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_( + GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_reporter_( &default_global_test_part_result_reporter_), per_thread_test_part_result_reporter_( &default_per_thread_test_part_result_reporter_), From 4219e7254cb8c473f57f6065bd13d1520d7b708f Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Fri, 1 Jul 2022 10:53:18 -0700 Subject: [PATCH 20/28] Remove the Bazel provided default cxxopt -std=c++0x and replace it with -std=c++14 when testing with GCC 5. PiperOrigin-RevId: 458502826 Change-Id: I83637a222b5c0a54e55d93ce7fdbc878af27b250 --- ci/linux-presubmit.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh index 09abdc87..f7e0f465 100644 --- a/ci/linux-presubmit.sh +++ b/ci/linux-presubmit.sh @@ -72,6 +72,7 @@ time docker run \ --workdir="/src" \ --rm \ --env="CC=/usr/local/bin/gcc" \ + --env="BAZEL_CXXOPTS=-std=c++14" \ ${LINUX_GCC_FLOOR_CONTAINER} \ /usr/local/bin/bazel test ... \ --copt="-Wall" \ From 7107c441885900fedb8458a96bddca16e9768573 Mon Sep 17 00:00:00 2001 From: Alexander Nikforov Date: Fri, 1 Jul 2022 15:33:13 -0700 Subject: [PATCH 21/28] cleanup from unique_ptr branch --- googlemock/src/gmock-internal-utils.cc | 3 +-- googletest/include/gtest/internal/gtest-internal.h | 3 +-- googletest/src/gtest.cc | 2 +- googletest/test/googletest-param-test-test.cc | 4 ++-- googletest/test/gtest-unittest-api_test.cc | 4 ++-- googletest/test/gtest_unittest.cc | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 0a74841f..9e2d9b8b 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -180,8 +180,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message, std::cout << "\n"; } std::cout << "Stack trace:\n" - << ::testing::internal::GetCurrentOsStackTraceExceptTop( - ::testing::UnitTest::GetInstance(), actual_to_skip); + << ::testing::internal::GetCurrentOsStackTraceExceptTop(actual_to_skip); } std::cout << ::std::flush; } diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 9b04e4c8..527dc999 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -829,8 +829,7 @@ class TypeParameterizedTestSuite { // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, - int skip_count); +GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 6f31dd22..9989f717 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -6245,7 +6245,7 @@ void UnitTestImpl::UnshuffleTests() { // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string -GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) { +GetCurrentOsStackTraceExceptTop(int skip_count) { // We pass skip_count + 1 to skip this wrapper function in addition // to what the user really wants to skip. return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index 848ef975..e3090ae4 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), TEST(MacroNameing, LookupNames) { std::set know_suite_names, know_test_names; - auto ins = testing::UnitTest::GetInstance(); + const auto& ins = testing::UnitTest::GetInstance(); int ts = 0; while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) { know_suite_names.insert(suite->name()); @@ -897,7 +897,7 @@ INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest, }); TEST(CustomNamingTest, CheckNameRegistry) { - ::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance(); + const auto& unit_test = ::testing::UnitTest::GetInstance(); std::set test_names; for (int suite_num = 0; suite_num < unit_test->total_test_suite_count(); ++suite_num) { diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc index 2a13fa32..2ea69273 100644 --- a/googletest/test/gtest-unittest-api_test.cc +++ b/googletest/test/gtest-unittest-api_test.cc @@ -106,7 +106,7 @@ const int kTypedTests = 1; // Since tests can be run in any order, the values the accessors that track // test execution (such as failed_test_count) can not be predicted. TEST(ApiTest, UnitTestImmutableAccessorsWork) { - UnitTest* unit_test = UnitTest::GetInstance(); + const auto& unit_test = UnitTest::GetInstance(); ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count()); EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count()); @@ -224,7 +224,7 @@ TEST(DISABLED_Test, Dummy2) {} class FinalSuccessChecker : public Environment { protected: void TearDown() override { - UnitTest* unit_test = UnitTest::GetInstance(); + const auto& unit_test = UnitTest::GetInstance(); EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count()); EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count()); diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index cdfdc6c4..b579e81e 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -7703,7 +7703,7 @@ auto* dynamic_test = testing::RegisterTest( __LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; }); TEST(RegisterTest, WasRegistered) { - auto* unittest = testing::UnitTest::GetInstance(); + const auto& unittest = testing::UnitTest::GetInstance(); for (int i = 0; i < unittest->total_test_suite_count(); ++i) { auto* tests = unittest->GetTestSuite(i); if (tests->name() != std::string("DynamicUnitTestFixture")) continue; From e009c3d3dcb522c21ea83984dac6064a6399d3f6 Mon Sep 17 00:00:00 2001 From: Chris Kennelly Date: Thu, 7 Jul 2022 09:18:16 -0700 Subject: [PATCH 22/28] Enable heterogeneous lookup for RegisteredTestsMap. PiperOrigin-RevId: 459529190 Change-Id: I6b29693000023b3562990742f27a98cc279b6452 --- googletest/include/gtest/internal/gtest-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 9b04e4c8..fff148cc 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -57,6 +57,7 @@ #include #include +#include #include #include #include @@ -631,7 +632,7 @@ class GTEST_API_ TypedTestSuitePState { const char* registered_tests); private: - typedef ::std::map RegisteredTestsMap; + typedef ::std::map> RegisteredTestsMap; bool registered_; RegisteredTestsMap registered_tests_; From 4556086674e4dfae2aa5f042d9e7844fc5ef9b89 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Fri, 8 Jul 2022 08:21:06 -0700 Subject: [PATCH 23/28] CMake: raise the default C++ standard to cxx_std_14 PiperOrigin-RevId: 459761499 Change-Id: Ifb4b8b9f2dc598f3f4afc66a9efc403e001e0262 --- googletest/cmake/internal_utils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 5a34c07a..a0aaa662 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -189,7 +189,7 @@ function(cxx_library_with_type name type cxx_flags) endif() if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8") - target_compile_features(${name} PUBLIC cxx_std_11) + target_compile_features(${name} PUBLIC cxx_std_14) endif() endfunction() From 4086e92d861a943d47033d641e97d2ad32faf63d Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Mon, 11 Jul 2022 10:16:57 -0700 Subject: [PATCH 24/28] Add envvar BAZEL_CXXOPTS=-std=c++14 to the GitHub Actions CI PiperOrigin-RevId: 460242683 Change-Id: I182a2e082d3a7e38fd3686e9e7af200ba0f954e0 --- .github/workflows/gtest-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml index 61fd47e2..036c392f 100644 --- a/.github/workflows/gtest-ci.yml +++ b/.github/workflows/gtest-ci.yml @@ -4,6 +4,9 @@ on: push: pull_request: +env: + BAZEL_CXXOPTS: -std=c++14 + jobs: Linux: runs-on: ubuntu-latest From 96ddde12359c8f20b6c27a99a6814c40b51f4452 Mon Sep 17 00:00:00 2001 From: Andrei Polushin Date: Mon, 11 Jul 2022 17:35:43 +0700 Subject: [PATCH 25/28] cmake: find python in order specified by PATH environment variable. CMake policy CMP0094 controls a lookup strategy used to find a Python executable: * CMP0094=OLD selects a Python executable with a higher version. * CMP0094=NEW selects a Python executable found earlier in PATH. NEW behavior is critical in presence of a Python virtual environment established and activated, i.e. added to the PATH variable. In case GoogleTest is embedded into a larger project, the result of `find_package(Python)` affects the whole build, not only GoogleTest component itself. --- googletest/cmake/internal_utils.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 107147f6..42850f59 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -244,6 +244,12 @@ function(cxx_executable name dir libs) ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN}) endfunction() +# CMP0094 policy enables finding a Python executable in the LOCATION order, as +# specified by the PATH environment variable. +if (POLICY CMP0094) + cmake_policy(SET CMP0094 NEW) +endif() + # Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE. if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") find_package(PythonInterp) From a2d6ee847e8f7181c6373901f55ae0abd69ec0ae Mon Sep 17 00:00:00 2001 From: Andrei Polushin Date: Mon, 11 Jul 2022 17:16:58 +0700 Subject: [PATCH 26/28] cmake: make PDB output directory match that of a static library. PDB files should be created at the same location as their primary artifact, which is either static library or a DLL. On Windows, an artifact location is controlled by: * RUNTIME_OUTPUT_DIRECTORY is a directory of a DLL artifact. * ARCHIVE_OUTPUT_DIRECTORY is a directory of a LIB artifact. A PDB file location is controlled: * PDB_OUTPUT_DIRECTORY should match a directory of a DLL artifact. * COMPILE_PDB_OUTPUT_DIRECTORY should match a directory of a LIB artifact. --- googletest/cmake/internal_utils.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 107147f6..b259ced4 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -162,7 +162,8 @@ function(cxx_library_with_type name type cxx_flags) RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") # make PDBs match library name get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX) set_target_properties(${name} From 3655149a60ad7bfeb0902f7308b95dafa97a68ad Mon Sep 17 00:00:00 2001 From: Andrei Polushin Date: Thu, 14 Jul 2022 21:36:41 +0700 Subject: [PATCH 27/28] export ThreadLocalValueHolderBase which is required by exported APIs. fixes #3944 --- googletest/include/gtest/internal/gtest-port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0003d276..c9e1f324 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1710,7 +1710,7 @@ typedef GTestMutexLock MutexLock; // C-linkage. Therefore it cannot be templatized to access // ThreadLocal. Hence the need for class // ThreadLocalValueHolderBase. -class ThreadLocalValueHolderBase { +class GTEST_API_ ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() {} }; From 2d1cd6ee277ea3de5803115568341da48e90676a Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Tue, 28 Jun 2022 10:47:00 +0200 Subject: [PATCH 28/28] Set cmake policy CMP0069 This ensures that LTO works as expected whenever the main project has it enabled. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4daf35b5..3cf5c270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,10 @@ if (POLICY CMP0077) cmake_policy(SET CMP0077 NEW) endif (POLICY CMP0077) +if (POLICY CMP0069) + cmake_policy(SET CMP0069 NEW) +endif (POLICY CMP0069) + project(googletest-distribution) set(GOOGLETEST_VERSION 1.11.0)