@ -48,6 +48,12 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set ( PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/" )
project ( ${ PACKAGE_NAME } C CXX )
if ( NOT MSVC )
set ( gRPC_INSTALL ON CACHE BOOL "Generate installation target" )
else ( )
set ( gRPC_INSTALL OFF CACHE BOOL "Generate installation target" )
endif ( )
set ( gRPC_ZLIB_PROVIDER "module" CACHE STRING "Provider of zlib library" )
set_property ( CACHE gRPC_ZLIB_PROVIDER PROPERTY STRINGS "module" "package" )
@ -59,6 +65,10 @@ set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")
set ( gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library" )
if ( MSVC )
add_definitions ( -D_WIN32_WINNT=0x600 )
endif ( )
if ( gRPC_USE_PROTO_LITE )
set ( _gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite" )
add_definitions ( "-DGRPC_USE_PROTO_LITE" )
@ -98,6 +108,7 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module")
set ( PROTOBUF_ROOT_DIR ${ CMAKE_CURRENT_SOURCE_DIR } /third_party/protobuf )
endif ( )
if ( EXISTS "${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt" )
set ( protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries" )
add_subdirectory ( ${ PROTOBUF_ROOT_DIR } /cmake third_party/protobuf )
if ( TARGET ${ _gRPC_PROTOBUF_LIBRARY_NAME } )
set ( _gRPC_PROTOBUF_LIBRARIES ${ _gRPC_PROTOBUF_LIBRARY_NAME } )
@ -270,11 +281,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS gpr EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc
@ -527,11 +540,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc_cronet
@ -757,11 +772,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc_cronet EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc_unsecure
@ -981,11 +998,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc_unsecure EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc++
@ -1149,11 +1168,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc++ EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc++_reflection
@ -1242,11 +1263,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc++_reflection EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc++_unsecure
@ -1406,11 +1429,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc++_unsecure EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc_plugin_support
@ -1446,11 +1471,13 @@ foreach(_hdr
endforeach ( )
if ( gRPC_INSTALL )
install ( TARGETS grpc_plugin_support EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_library ( grpc_csharp_ext
@ -1473,11 +1500,13 @@ target_link_libraries(grpc_csharp_ext
if ( gRPC_INSTALL )
install ( TARGETS grpc_csharp_ext EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
@ -1500,11 +1529,13 @@ target_link_libraries(gen_hpack_tables
)
if ( gRPC_INSTALL )
install ( TARGETS gen_hpack_tables EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( gen_legal_metadata_characters
@ -1522,11 +1553,13 @@ target_include_directories(gen_legal_metadata_characters
if ( gRPC_INSTALL )
install ( TARGETS gen_legal_metadata_characters EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_create_jwt
@ -1549,11 +1582,13 @@ target_link_libraries(grpc_create_jwt
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_create_jwt EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_print_google_default_creds_token
@ -1575,11 +1610,13 @@ target_link_libraries(grpc_print_google_default_creds_token
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_print_google_default_creds_token EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_verify_jwt
@ -1601,11 +1638,13 @@ target_link_libraries(grpc_verify_jwt
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_verify_jwt EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_cpp_plugin
@ -1627,11 +1666,13 @@ target_link_libraries(grpc_cpp_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_cpp_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_csharp_plugin
@ -1653,11 +1694,13 @@ target_link_libraries(grpc_csharp_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_csharp_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_node_plugin
@ -1679,11 +1722,13 @@ target_link_libraries(grpc_node_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_node_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_objective_c_plugin
@ -1705,11 +1750,13 @@ target_link_libraries(grpc_objective_c_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_objective_c_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_python_plugin
@ -1731,11 +1778,13 @@ target_link_libraries(grpc_python_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_python_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
add_executable ( grpc_ruby_plugin
@ -1757,11 +1806,13 @@ target_link_libraries(grpc_ruby_plugin
)
if ( gRPC_INSTALL )
install ( TARGETS grpc_ruby_plugin EXPORT gRPCTargets
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
endif ( )
@ -1770,10 +1821,12 @@ install(TARGETS grpc_ruby_plugin EXPORT gRPCTargets
if ( gRPC_INSTALL )
install ( EXPORT gRPCTargets
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ C M A K E D I R }
N A M E S P A C E g R P C : :
)
endif ( )
foreach ( _config gRPCConfig gRPCConfigVersion )
configure_file ( tools/cmake/ ${ _config } .cmake.in