aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/CMakeLists.txt.template
diff options
context:
space:
mode:
Diffstat (limited to 'templates/CMakeLists.txt.template')
-rw-r--r--templates/CMakeLists.txt.template15
1 files changed, 5 insertions, 10 deletions
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index b034763fb0..444fb6a2dc 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -129,11 +129,13 @@
if(WIN32)
set(_gRPC_PLATFORM_WINDOWS ON)
endif()
+
+ ## Some libraries are shared even with BUILD_SHARED_LIBRARIES=OFF
+ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
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 boringssl
- add_definitions(/wd4464 /wd4623 /wd4668 /wd4701 /wd4702 /wd4777 /wd5027)
# needed to compile protobuf
add_definitions(/wd4065 /wd4506)
# TODO(jtattermusch): revisit C4267 occurrences throughout the code
@@ -428,7 +430,7 @@
% endfor
<%def name="cc_library(lib)">
- add_library(${lib.name}
+ add_library(${lib.name}${' SHARED' if lib.get('dll', None) == 'only' else ''}
% for src in lib.src:
% if not proto_re.match(src):
${src}
@@ -552,13 +554,6 @@
endif()
</%def>
- if (gRPC_INSTALL)
- install(EXPORT gRPCTargets
- DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR}</%text>
- NAMESPACE gRPC::
- )
- endif()
-
foreach(_config gRPCConfig gRPCConfigVersion)
configure_file(tools/cmake/<%text>${_config}</%text>.cmake.in
<%text>${_config}</%text>.cmake @ONLY)