Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3657,8 +3657,25 @@ macro(build_grpc)
# Yuck, see https://stackoverflow.com/a/45433229/776560
string(REPLACE ";" "|" GRPC_PREFIX_PATH_ALT_SEP "${GRPC_CMAKE_PREFIX}")

set(GRPC_C_FLAGS "${EP_C_FLAGS}")
set(GRPC_CXX_FLAGS "${EP_CXX_FLAGS}")
if(NOT MSVC)
# Negate warnings that gRPC cannot build under
# See https://github.com/grpc/grpc/issues/29417
set(GRPC_C_FLAGS
"${GRPC_C_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option"
)
set(GRPC_CXX_FLAGS
"${GRPC_CXX_FLAGS} -Wno-attributes -Wno-format-security -Wno-unknown-warning-option"
)
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to initialize GRPC_C*_FLAGS for MSVC.

e.g.:

set(GRPC_C_FLAGS "${EP_C_FLAGS}")
set(GRPC_CXX_FLAGS "${EP_CXX_FLAGS}")
if(NOT MSVC)
  set(GRPC_C_FLAGS "${GRPC_C_FLAGS} ...")
  set(GRPC_CXX_FLAGS "${GRPC_CXX_FLAGS} ...")
endif()

Or

set(GRPC_CMAKE_ARGS ...)
if(NOT MSVC)
  set(GRPC_C_FLAGS "${EP_C_FLAGS} ...")
  set(GRPC_CXX_FLAGS "${EP_CXX_FLAGS} ...")
  list(APPEND GRPC_CMAKE_ARGS "-DCMAKE_C_FLAGS=${GRPC_C_FLAGS}" ...)
endif()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh…thanks for catching that


set(GRPC_CMAKE_ARGS
"${EP_COMMON_CMAKE_ARGS}"
"-DCMAKE_C_FLAGS=${GRPC_C_FLAGS}"
"-DCMAKE_CXX_FLAGS=${GRPC_CXX_FLAGS}"
"-DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${GRPC_C_FLAGS}"
"-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${GRPC_CXX_FLAGS}"
-DCMAKE_PREFIX_PATH='${GRPC_PREFIX_PATH_ALT_SEP}'
-DgRPC_ABSL_PROVIDER=package
-DgRPC_BUILD_CSHARP_EXT=OFF
Expand Down