diff options
author | yourfather <597494370@qq.com> | 2023-12-08 02:45:18 (GMT) |
---|---|---|
committer | simon <597494370@qq.com> | 2023-12-30 02:38:12 (GMT) |
commit | 8eedf9330a8f188290456cc3fd2c6f94fbd280ed (patch) | |
tree | ba19868933ab4b396e627293fa8743fd0c8cbb4b | |
parent | 9772a299e98880aebc55bf3684712f5046dfdbc6 (diff) | |
download | Ninja-8eedf9330a8f188290456cc3fd2c6f94fbd280ed.zip Ninja-8eedf9330a8f188290456cc3fd2c6f94fbd280ed.tar.gz Ninja-8eedf9330a8f188290456cc3fd2c6f94fbd280ed.tar.bz2 |
[FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as error
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9529d1..8a5ef00 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_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "1.11.3") + check_cxx_compiler_flag(-Wno-maybe-uninitialized flag_no_maybe_uninit) + if (flag_no_maybe_uninit) + target_compile_options(gtest PRIVATE -Wno-maybe-uninitialized) + endif() + endif() + endif() endif() |