diff options
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9529d1..90e3418 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,6 +252,16 @@ if(BUILD_TESTING) if (NOT TARGET GTest::gtest) message(STATUS "Defining GTest::gtest alias to work-around bug in older release.") add_library(GTest::gtest ALIAS gtest) + + # NOTE: gtest uninit some variables, gcc >= 1.11.3 may cause error on compile. + # Remove this comment and six lines below, once ninja deps gtest-1.11.0 or above. + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "1.11.3") + check_cxx_compiler_flag(-Wmaybe-uninitialized flag_maybe_uninit) + if (flag_maybe_uninit) + target_compile_options(gtest PRIVATE -Wno-maybe-uninitialized) + endif() + endif() + endif() endif() |