diff --git a/CMakeLists.txt b/CMakeLists.txt index a89efb493d0..6ce00ecacdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,14 +100,16 @@ if (MSVC) include(cmake/msvc_static_runtime.cmake) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) # needed to compile protobuf - add_definitions(/wd4065 /wd4506) + set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4065 /wd4506") # TODO(jtattermusch): revisit warnings that were silenced as part of upgrade to protobuf3.6.0 - add_definitions(/wd4200 /wd4291 /wd4244) + set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4200 /wd4291 /wd4244") # TODO(jtattermusch): revisit C4267 occurrences throughout the code - add_definitions(/wd4267) + set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4267") # TODO(jtattermusch): needed to build boringssl with VS2017, revisit later - add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619) + set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4987 /wd4774 /wd4819 /wd4996 /wd4619") endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}") if (gRPC_USE_PROTO_LITE) set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite") diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 16fc78d99ae..77769cb93bf 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -149,14 +149,16 @@ include(cmake/msvc_static_runtime.cmake) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) # needed to compile protobuf - add_definitions(/wd4065 /wd4506) + set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS} /wd4065 /wd4506") # TODO(jtattermusch): revisit warnings that were silenced as part of upgrade to protobuf3.6.0 - add_definitions(/wd4200 /wd4291 /wd4244) + set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS} /wd4200 /wd4291 /wd4244") # TODO(jtattermusch): revisit C4267 occurrences throughout the code - add_definitions(/wd4267) + set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS} /wd4267") # TODO(jtattermusch): needed to build boringssl with VS2017, revisit later - add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619) + set(_gRPC_C_CXX_FLAGS "<%text>${_gRPC_C_CXX_FLAGS} /wd4987 /wd4774 /wd4819 /wd4996 /wd4619") endif() + set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "<%text>${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}") if (gRPC_USE_PROTO_LITE) set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite")