Skip to content

Commit

Permalink
fix: windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
natiz committed Nov 27, 2022
1 parent d209a34 commit 6b4dd60
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/grpc-tools/CMakeLists.txt
@@ -1,17 +1,21 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.15)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

# MSVC runtime library flags are selected by an abstraction.
if(COMMAND cmake_policy AND POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf)
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf)

set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests")
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.")
set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf)
add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf)

set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector")
Expand All @@ -22,7 +26,7 @@ add_executable(grpc_node_plugin
)

if (MSVC)
add_definitions(/MTd)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
endif (MSVC)

target_include_directories(grpc_node_plugin
Expand All @@ -34,4 +38,4 @@ target_include_directories(grpc_node_plugin
target_link_libraries(grpc_node_plugin
libprotoc
libprotobuf
)
)

1 comment on commit 6b4dd60

@yinzara
Copy link

@yinzara yinzara commented on 6b4dd60 May 5, 2023

Choose a reason for hiding this comment

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

I believe that this commit could be the cause of #2338 though I'm not 100% sure.
It's one of the only recent change to how its built and linked.

Please sign in to comment.