Skip to content

Commit 32cfd75

Browse files
committed
Supress gcc warning on protobuf-generated sources
The warning is spurious but reasonable based on the protobuf generated code
1 parent 81cf914 commit 32cfd75

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ endif()
172172
protobuf_generate_cpp(GNS_COMMON_PROTO_SRCS GNS_COMMON_PROTO_HDRS ${GNS_COMMON_PROTOS})
173173
protobuf_generate_cpp(GNS_CLIENTLIB_PROTO_SRCS GNS_CLIENTLIB_PROTO_HDRS ${GNS_CLIENTLIB_PROTOS})
174174

175+
# GCC 15 can emit -Wstringop-overflow on protobuf-generated struct copy patterns.
176+
# Keep -Werror for all hand-written code, but do not fail builds on this one
177+
# warning class in generated protobuf translation units.
178+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
179+
set_source_files_properties(
180+
${GNS_COMMON_PROTO_SRCS}
181+
${GNS_CLIENTLIB_PROTO_SRCS}
182+
PROPERTIES COMPILE_OPTIONS "-Wno-error=stringop-overflow"
183+
)
184+
endif()
185+
175186
function(gns_set_target_protobuf_properties TGT )
176187
target_link_libraries(${TGT} PUBLIC
177188
protobuf::libprotobuf

0 commit comments

Comments
 (0)