From c05f2085b773012dd8fab66d70946a184f50ba75 Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Mon, 13 Dec 2021 04:53:43 +0300 Subject: [PATCH 1/2] move gtest-specific check into gtest/CMakeLists.txt --- test/CMakeLists.txt | 7 ------- test/gtest/CMakeLists.txt | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6a27e33f5f9d..4df9e614049c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,13 +8,6 @@ target_link_libraries(test-main gtest) include(CheckCXXCompilerFlag) -# Workaround GTest bug https://github.com/google/googletest/issues/705. -check_cxx_compiler_flag( - -fno-delete-null-pointer-checks HAVE_FNO_DELETE_NULL_POINTER_CHECKS) -if (HAVE_FNO_DELETE_NULL_POINTER_CHECKS) - target_compile_options(test-main PUBLIC -fno-delete-null-pointer-checks) -endif () - # Use less strict pedantic flags for the tests because GMock doesn't compile # cleanly with -pedantic and -std=c++98. if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt index 1282d62afac6..0cc4e1aa3367 100644 --- a/test/gtest/CMakeLists.txt +++ b/test/gtest/CMakeLists.txt @@ -17,6 +17,13 @@ else () target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0) endif () +# Workaround GTest bug https://github.com/google/googletest/issues/705. +check_cxx_compiler_flag( + -fno-delete-null-pointer-checks HAVE_FNO_DELETE_NULL_POINTER_CHECKS) +if (HAVE_FNO_DELETE_NULL_POINTER_CHECKS) + target_compile_options(gtest PUBLIC -fno-delete-null-pointer-checks) +endif () + if (MSVC) # Disable MSVC warnings of _CRT_INSECURE_DEPRECATE functions. target_compile_definitions(gtest PRIVATE _CRT_SECURE_NO_WARNINGS) From 272c34cefdb40eaa749f469a36edaae65c527145 Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Mon, 13 Dec 2021 04:54:29 +0300 Subject: [PATCH 2/2] remove commented out lines --- test/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4df9e614049c..a0fbd05fc892 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,12 +8,6 @@ target_link_libraries(test-main gtest) include(CheckCXXCompilerFlag) -# Use less strict pedantic flags for the tests because GMock doesn't compile -# cleanly with -pedantic and -std=c++98. -if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - #set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wno-long-long -Wno-variadic-macros) -endif () - function(add_fmt_executable name) add_executable(${name} ${ARGN}) if (MINGW)