Merge pull request #20770 from KyleFromKitware/soversion

cmake: Add VERSION and SOVERSION properties to libraries
pull/20724/head^2
Jan Tattermusch 5 years ago committed by GitHub
commit a861d159c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 190
      CMakeLists.txt
  2. 18
      templates/CMakeLists.txt.template

@ -26,6 +26,11 @@ cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.25.0-dev")
set(gRPC_CORE_VERSION "8.0.0")
set(gRPC_CORE_SOVERSION "8")
set(gRPC_CPP_VERSION "1.25.0-dev")
set(gRPC_CPP_SOVERSION "1")
set(gRPC_CSHARP_VERSION "2.25.0-dev")
set(gRPC_CSHARP_SOVERSION "2")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
@ -769,6 +774,11 @@ add_library(address_sorting
third_party/address_sorting/address_sorting_windows.c
)
set_target_properties(address_sorting PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(address_sorting PROPERTIES COMPILE_PDB_NAME "address_sorting"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -817,6 +827,11 @@ add_library(alts_test_util
test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc
)
set_target_properties(alts_test_util PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(alts_test_util PROPERTIES COMPILE_PDB_NAME "alts_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -895,6 +910,11 @@ add_library(gpr
src/core/lib/profiling/stap_timers.cc
)
set_target_properties(gpr PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(gpr PROPERTIES COMPILE_PDB_NAME "gpr"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -1361,6 +1381,11 @@ add_library(grpc
src/core/plugin_registry/grpc_plugin_registry.cc
)
set_target_properties(grpc PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc PROPERTIES COMPILE_PDB_NAME "grpc"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -1776,6 +1801,11 @@ add_library(grpc_cronet
src/core/tsi/transport_security_grpc.cc
)
set_target_properties(grpc_cronet PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_cronet PROPERTIES COMPILE_PDB_NAME "grpc_cronet"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2127,6 +2157,11 @@ add_library(grpc_test_util
src/core/ext/filters/http/server/http_server_filter.cc
)
set_target_properties(grpc_test_util PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_test_util PROPERTIES COMPILE_PDB_NAME "grpc_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2475,6 +2510,11 @@ add_library(grpc_test_util_unsecure
src/core/ext/filters/http/server/http_server_filter.cc
)
set_target_properties(grpc_test_util_unsecure PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_test_util_unsecure PROPERTIES COMPILE_PDB_NAME "grpc_test_util_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2865,6 +2905,11 @@ add_library(grpc_unsecure
src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
)
set_target_properties(grpc_unsecure PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_unsecure PROPERTIES COMPILE_PDB_NAME "grpc_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -2962,6 +3007,11 @@ add_library(reconnect_server
test/core/util/reconnect_server.cc
)
set_target_properties(reconnect_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(reconnect_server PROPERTIES COMPILE_PDB_NAME "reconnect_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3004,6 +3054,11 @@ add_library(test_tcp_server
test/core/util/test_tcp_server.cc
)
set_target_properties(test_tcp_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(test_tcp_server PROPERTIES COMPILE_PDB_NAME "test_tcp_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3051,6 +3106,11 @@ add_library(bm_callback_test_service_impl
test/cpp/microbenchmarks/callback_test_service.cc
)
set_target_properties(bm_callback_test_service_impl PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bm_callback_test_service_impl PROPERTIES COMPILE_PDB_NAME "bm_callback_test_service_impl"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3108,6 +3168,11 @@ add_library(dns_test_util
test/cpp/naming/dns_test_util.cc
)
set_target_properties(dns_test_util PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(dns_test_util PROPERTIES COMPILE_PDB_NAME "dns_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3204,6 +3269,11 @@ add_library(grpc++
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++ PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++ PROPERTIES COMPILE_PDB_NAME "grpc++"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3531,6 +3601,11 @@ add_library(grpc++_core_stats
src/cpp/util/core_stats.cc
)
set_target_properties(grpc++_core_stats PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_core_stats PROPERTIES COMPILE_PDB_NAME "grpc++_core_stats"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3585,6 +3660,11 @@ add_library(grpc++_error_details
src/cpp/util/error_details.cc
)
set_target_properties(grpc++_error_details PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_error_details PROPERTIES COMPILE_PDB_NAME "grpc++_error_details"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3657,6 +3737,11 @@ add_library(grpc++_proto_reflection_desc_db
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc++_proto_reflection_desc_db PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_proto_reflection_desc_db PROPERTIES COMPILE_PDB_NAME "grpc++_proto_reflection_desc_db"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3723,6 +3808,11 @@ add_library(grpc++_reflection
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc++_reflection PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_reflection PROPERTIES COMPILE_PDB_NAME "grpc++_reflection"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3790,6 +3880,11 @@ add_library(grpc++_test_config
test/cpp/util/test_config_cc.cc
)
set_target_properties(grpc++_test_config PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_config PROPERTIES COMPILE_PDB_NAME "grpc++_test_config"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -3869,6 +3964,11 @@ add_library(grpc++_test_util
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_test_util PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_util PROPERTIES COMPILE_PDB_NAME "grpc++_test_util"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4082,6 +4182,11 @@ add_library(grpc++_test_util_unsecure
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_test_util_unsecure PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_test_util_unsecure PROPERTIES COMPILE_PDB_NAME "grpc++_test_util_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4309,6 +4414,11 @@ add_library(grpc++_unsecure
src/cpp/codegen/codegen_init.cc
)
set_target_properties(grpc++_unsecure PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc++_unsecure PROPERTIES COMPILE_PDB_NAME "grpc++_unsecure"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4624,6 +4734,11 @@ add_library(grpc_benchmark
test/cpp/microbenchmarks/helpers.cc
)
set_target_properties(grpc_benchmark PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_benchmark PROPERTIES COMPILE_PDB_NAME "grpc_benchmark"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4682,6 +4797,11 @@ add_library(grpc_cli_libs
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h
)
set_target_properties(grpc_cli_libs PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_cli_libs PROPERTIES COMPILE_PDB_NAME "grpc_cli_libs"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4749,6 +4869,11 @@ add_library(grpc_plugin_support
src/compiler/ruby_generator.cc
)
set_target_properties(grpc_plugin_support PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_plugin_support PROPERTIES COMPILE_PDB_NAME "grpc_plugin_support"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4813,6 +4938,11 @@ add_library(grpcpp_channelz
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h
)
set_target_properties(grpcpp_channelz PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpcpp_channelz PROPERTIES COMPILE_PDB_NAME "grpcpp_channelz"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4892,6 +5022,11 @@ add_library(http2_client_main
test/cpp/interop/http2_client.cc
)
set_target_properties(http2_client_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(http2_client_main PROPERTIES COMPILE_PDB_NAME "http2_client_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -4957,6 +5092,11 @@ add_library(interop_client_helper
test/cpp/interop/client_helper.cc
)
set_target_properties(interop_client_helper PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_client_helper PROPERTIES COMPILE_PDB_NAME "interop_client_helper"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5025,6 +5165,11 @@ add_library(interop_client_main
test/cpp/interop/interop_client.cc
)
set_target_properties(interop_client_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_client_main PROPERTIES COMPILE_PDB_NAME "interop_client_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5087,6 +5232,11 @@ add_library(interop_server_helper
test/cpp/interop/server_helper.cc
)
set_target_properties(interop_server_helper PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_helper PROPERTIES COMPILE_PDB_NAME "interop_server_helper"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5150,6 +5300,11 @@ add_library(interop_server_lib
test/cpp/interop/interop_server.cc
)
set_target_properties(interop_server_lib PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_lib PROPERTIES COMPILE_PDB_NAME "interop_server_lib"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5212,6 +5367,11 @@ add_library(interop_server_main
test/cpp/interop/interop_server_bootstrap.cc
)
set_target_properties(interop_server_main PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(interop_server_main PROPERTIES COMPILE_PDB_NAME "interop_server_main"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5299,6 +5459,11 @@ add_library(qps
test/cpp/qps/usage_timer.cc
)
set_target_properties(qps PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(qps PROPERTIES COMPILE_PDB_NAME "qps"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5371,6 +5536,11 @@ add_library(grpc_csharp_ext SHARED
src/csharp/ext/grpc_csharp_ext.c
)
set_target_properties(grpc_csharp_ext PROPERTIES
VERSION ${gRPC_CSHARP_VERSION}
SOVERSION ${gRPC_CSHARP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(grpc_csharp_ext PROPERTIES COMPILE_PDB_NAME "grpc_csharp_ext"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5420,6 +5590,11 @@ add_library(bad_client_test
test/core/bad_client/bad_client.cc
)
set_target_properties(bad_client_test PROPERTIES
VERSION ${gRPC_CPP_VERSION}
SOVERSION ${gRPC_CPP_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bad_client_test PROPERTIES COMPILE_PDB_NAME "bad_client_test"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5468,6 +5643,11 @@ add_library(bad_ssl_test_server
test/core/bad_ssl/server_common.cc
)
set_target_properties(bad_ssl_test_server PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(bad_ssl_test_server PROPERTIES COMPILE_PDB_NAME "bad_ssl_test_server"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5588,6 +5768,11 @@ add_library(end2end_tests
test/core/end2end/tests/write_buffering_at_end.cc
)
set_target_properties(end2end_tests PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(end2end_tests PROPERTIES COMPILE_PDB_NAME "end2end_tests"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
@ -5708,6 +5893,11 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/write_buffering_at_end.cc
)
set_target_properties(end2end_nosec_tests PROPERTIES
VERSION ${gRPC_CORE_VERSION}
SOVERSION ${gRPC_CORE_SOVERSION}
)
if(WIN32 AND MSVC)
set_target_properties(end2end_nosec_tests PROPERTIES COMPILE_PDB_NAME "end2end_nosec_tests"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"

@ -74,6 +74,11 @@
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "${settings.cpp_version}")
set(gRPC_CORE_VERSION "${settings.core_version}")
set(gRPC_CORE_SOVERSION "${settings.core_version.major}")
set(gRPC_CPP_VERSION "${settings.cpp_version}")
set(gRPC_CPP_SOVERSION "${settings.cpp_version.major}")
set(gRPC_CSHARP_VERSION "${settings.csharp_version}")
set(gRPC_CSHARP_SOVERSION "${settings.csharp_version.major}")
set(PACKAGE_STRING "<%text>${PACKAGE_NAME} ${PACKAGE_VERSION}</%text>")
set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
@ -400,6 +405,19 @@
% endfor
)
set_target_properties(${lib.name} PROPERTIES
% if lib.language == 'c++':
VERSION <%text>${gRPC_CPP_VERSION}</%text>
SOVERSION <%text>${gRPC_CPP_SOVERSION}</%text>
% elif lib.language == 'csharp':
VERSION <%text>${gRPC_CSHARP_VERSION}</%text>
SOVERSION <%text>${gRPC_CSHARP_SOVERSION}</%text>
% else:
VERSION <%text>${gRPC_CORE_VERSION}</%text>
SOVERSION <%text>${gRPC_CORE_SOVERSION}</%text>
% endif
)
if(WIN32 AND MSVC)
set_target_properties(${lib.name} PROPERTIES COMPILE_PDB_NAME "${lib.name}"
COMPILE_PDB_OUTPUT_DIRECTORY <%text>"${CMAKE_BINARY_DIR}</%text>"

Loading…
Cancel
Save