Skip to content

Commit 51d6dd3

Browse files
committed
Move the '-Wno-error=deprecated-declarations' to a common target_compile_options
1 parent 26f9617 commit 51d6dd3

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,6 +3271,16 @@ function(build_grpc)
32713271
add_executable(gRPC::grpc_cpp_plugin ALIAS grpc_cpp_plugin)
32723272
endif()
32733273

3274+
# gRPC headers use deprecated std::iterator that causes compilation errors.
3275+
# This workaround can be removed once we upgrade to a newer gRPC version.
3276+
if(NOT MSVC)
3277+
foreach(target ${GRPC_LIBRARY_TARGETS})
3278+
if(TARGET ${target})
3279+
target_compile_options(${target} INTERFACE -Wno-error=deprecated-declarations)
3280+
endif()
3281+
endforeach()
3282+
endif()
3283+
32743284
# Add gRPC libraries to bundled static libs.
32753285
list(APPEND
32763286
ARROW_BUNDLED_STATIC_LIBS

cpp/examples/arrow/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ if(ARROW_FLIGHT)
127127
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc"
128128
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
129129

130-
# gRPC headers use deprecated std::iterator (deprecated in C++17, removed in C++20).
131-
# This causes compilation errors with GCC 15+ when using -Werror.
132-
# This workaround can be removed once we upgrade to a newer gRPC version that doesn't
133-
# use std::iterator (likely gRPC 1.60+).
134-
# TODO: Can't we pass this to add_arrow_example() to apply it to the target directly?
135-
if(NOT MSVC)
136-
target_compile_options(flight-grpc-example PRIVATE -Wno-error=deprecated-declarations)
137-
endif()
138-
139130
if(ARROW_FLIGHT_SQL)
140131
if(ARROW_BUILD_SHARED AND ARROW_GRPC_USE_SHARED)
141132
set(FLIGHT_SQL_EXAMPLES_LINK_LIBS arrow_flight_sql_shared)
@@ -152,13 +143,6 @@ if(ARROW_FLIGHT)
152143
gRPC::grpc++
153144
${ARROW_PROTOBUF_LIBPROTOBUF}
154145
${GFLAGS_LIBRARIES})
155-
156-
# gRPC headers use deprecated std::iterator
157-
# TODO: Can't we pass this to add_arrow_example() to apply it to the target directly?
158-
if(NOT MSVC)
159-
target_compile_options(flight-sql-example
160-
PRIVATE -Wno-error=deprecated-declarations)
161-
endif()
162146
endif()
163147
endif()
164148

cpp/src/arrow/flight/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717

1818
add_custom_target(arrow_flight)
1919

20-
# gRPC headers use deprecated std::iterator (deprecated in C++17, removed in C++20).
21-
# This causes compilation errors with GCC 15+ when using -Werror.
22-
# This workaround can be removed once we upgrade to a newer gRPC version that doesn't
23-
# use std::iterator (likely gRPC 1.60+).
24-
# Apply to all Flight targets (libraries, tests, executables) in this directory.
25-
# TODO: Check whether this is global and try a better approach if so.
26-
if(NOT MSVC)
27-
add_compile_options(-Wno-error=deprecated-declarations)
28-
endif()
29-
3020
arrow_install_all_headers("arrow/flight")
3121

3222
# If libarrow_flight.a is only built, "pkg-config --cflags --libs

0 commit comments

Comments
 (0)