From 1adee75e1c2a1fe2d3db802be5dfa1526ecff575 Mon Sep 17 00:00:00 2001 From: vitaut Date: Thu, 4 Feb 2016 08:36:41 -0800 Subject: [PATCH] Check if -fno-delete-null-pointer-checks flag is supported --- test/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 64784a4f..10e753fc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -43,7 +43,11 @@ target_compile_definitions(test-main PUBLIC target_link_libraries(test-main gmock cppformat) # Workaround GTest bug https://github.com/google/googletest/issues/705. -target_compile_options(test-main PUBLIC -fno-delete-null-pointer-checks) +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 () # relax pedantic flags for the tests # TODO: fix warnings in tests to make this redundant. (e.g. -Wshadow,...)