Skip to content

Commit

Permalink
Merge pull request #2360 from Simonhancrew/master
Browse files Browse the repository at this point in the history
[FIX] compile: gcc version > 11.3, treat -Wmaybe-uninitialized as error
  • Loading branch information
jhasse authored Jan 2, 2024
2 parents 766eca4 + 8eedf93 commit fd70676
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit fd70676

Please sign in to comment.