blob: e517355d340cf6d2e8af37a7d74e52a7101afe33 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 2279e30be5796e9b185545543ea54fe68633cbdd Mon Sep 17 00:00:00 2001
Brad Bishop316dfdd2018-06-25 12:45:53 -04002From: Alexey Firago <alexey_firago@mentor.com>
3Date: Mon, 30 Oct 2017 23:24:49 +0300
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004Subject: [PATCH] CMakeLists.txt: Fix libraries installation for Linux
Brad Bishop316dfdd2018-06-25 12:45:53 -04005
6* Set libs versions as in Makefile
7
8Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
9
Brad Bishop316dfdd2018-06-25 12:45:53 -040010---
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011 CMakeLists.txt | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
12 1 file changed, 59 insertions(+)
Brad Bishop316dfdd2018-06-25 12:45:53 -040013
Brad Bishop316dfdd2018-06-25 12:45:53 -040014--- a/CMakeLists.txt
15+++ b/CMakeLists.txt
Brad Bishop26bdd442019-08-16 17:08:17 -040016@@ -30,6 +30,15 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-$
Brad Bishop316dfdd2018-06-25 12:45:53 -040017 set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
18 project(${PACKAGE_NAME} C CXX)
19
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020+set (CORE_VERSION_MAJOR "6")
21+set (CORE_VERSION "6.0.0")
Brad Bishop316dfdd2018-06-25 12:45:53 -040022+
23+set (CPP_VERSION_MAJOR "1")
24+set (CPP_VERSION "${PACKAGE_VERSION}")
25+
26+set (CSHARP_VERSION_MAJOR "1")
27+set (CSHARP_VERSION "${PACKAGE_VERSION}")
28+
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080029 set(gRPC_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables")
30 set(gRPC_INSTALL_LIBDIR "lib" CACHE STRING "Installation directory for libraries")
31 set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers")
Brad Bishop63ae8782019-10-09 09:56:13 -040032@@ -777,6 +786,10 @@ if(WIN32 AND MSVC)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033 endif()
34 endif()
35
36+if(_gRPC_PLATFORM_LINUX)
37+ set_property(TARGET address_sorting PROPERTY VERSION ${CORE_VERSION})
38+ set_property(TARGET address_sorting PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
39+endif()
40
41 target_include_directories(address_sorting
42 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop26bdd442019-08-16 17:08:17 -040043@@ -903,6 +916,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -040044 endif()
45 endif()
46
47+if(_gRPC_PLATFORM_LINUX)
48+ set_property(TARGET gpr PROPERTY VERSION ${CORE_VERSION})
49+ set_property(TARGET gpr PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
50+endif()
51
52 target_include_directories(gpr
53 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -040054@@ -1367,6 +1384,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -040055 endif()
56 endif()
57
58+if(_gRPC_PLATFORM_LINUX)
59+ set_property(TARGET grpc PROPERTY VERSION ${CORE_VERSION})
60+ set_property(TARGET grpc PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
61+endif()
62
63 target_include_directories(grpc
64 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -040065@@ -1782,6 +1803,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -040066 endif()
67 endif()
68
69+if(_gRPC_PLATFORM_LINUX)
70+ set_property(TARGET grpc_cronet PROPERTY VERSION ${CORE_VERSION})
71+ set_property(TARGET grpc_cronet PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
72+endif()
73
74 target_include_directories(grpc_cronet
75 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -040076@@ -2869,6 +2894,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -040077 endif()
78 endif()
79
80+if(_gRPC_PLATFORM_LINUX)
81+ set_property(TARGET grpc_unsecure PROPERTY VERSION ${CORE_VERSION})
82+ set_property(TARGET grpc_unsecure PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
83+endif()
84
85 target_include_directories(grpc_unsecure
86 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -040087@@ -3206,6 +3235,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -040088 endif()
89 endif()
90
91+if(_gRPC_PLATFORM_LINUX)
92+ set_property(TARGET grpc++ PROPERTY VERSION ${CPP_VERSION})
93+ set_property(TARGET grpc++ PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
94+endif()
95
96 target_include_directories(grpc++
97 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -040098@@ -3589,6 +3622,11 @@ protobuf_generate_grpc_cpp(
Brad Bishop316dfdd2018-06-25 12:45:53 -040099 src/proto/grpc/status/status.proto
100 )
101
102+if(_gRPC_PLATFORM_LINUX)
103+ set_property(TARGET grpc++_error_details PROPERTY VERSION ${CPP_VERSION})
104+ set_property(TARGET grpc++_error_details PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
105+endif()
106+
107 target_include_directories(grpc++_error_details
108 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
109 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
Brad Bishop63ae8782019-10-09 09:56:13 -0400110@@ -3727,6 +3765,11 @@ protobuf_generate_grpc_cpp(
Brad Bishop316dfdd2018-06-25 12:45:53 -0400111 src/proto/grpc/reflection/v1alpha/reflection.proto
112 )
113
114+if(_gRPC_PLATFORM_LINUX)
115+ set_property(TARGET grpc++_reflection PROPERTY VERSION ${CPP_VERSION})
116+ set_property(TARGET grpc++_reflection PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
117+endif()
118+
119 target_include_directories(grpc++_reflection
120 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
121 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
Brad Bishop63ae8782019-10-09 09:56:13 -0400122@@ -3816,6 +3859,10 @@ target_link_libraries(grpc++_test_config
123 ${_gRPC_GFLAGS_LIBRARIES}
124 )
125
126+if(_gRPC_PLATFORM_LINUX)
127+ set_property(TARGET grpc++_cronet PROPERTY VERSION ${CPP_VERSION})
128+ set_property(TARGET grpc++_cronet PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
129+endif()
130
131 endif (gRPC_BUILD_TESTS)
132 if (gRPC_BUILD_TESTS)
133@@ -4307,6 +4354,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -0400134 endif()
135 endif()
136
137+if(_gRPC_PLATFORM_LINUX)
138+ set_property(TARGET grpc++_unsecure PROPERTY VERSION ${CPP_VERSION})
139+ set_property(TARGET grpc++_unsecure PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
140+endif()
141
142 target_include_directories(grpc++_unsecure
143 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -0400144@@ -4745,6 +4796,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -0400145 endif()
146 endif()
147
148+if(_gRPC_PLATFORM_LINUX)
149+ set_property(TARGET grpc_plugin_support PROPERTY VERSION ${CORE_VERSION})
150+ set_property(TARGET grpc_plugin_support PROPERTY SOVERSION ${CORE_VERSION_MAJOR})
151+endif()
152
153 target_include_directories(grpc_plugin_support
154 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Brad Bishop63ae8782019-10-09 09:56:13 -0400155@@ -4813,6 +4868,11 @@ protobuf_generate_grpc_cpp(
Brad Bishop26bdd442019-08-16 17:08:17 -0400156 src/proto/grpc/channelz/channelz.proto
157 )
158
159+if(_gRPC_PLATFORM_LINUX)
160+ set_property(TARGET grpcpp_channelz PROPERTY VERSION ${CPP_VERSION})
161+ set_property(TARGET grpcpp_channelz PROPERTY SOVERSION ${CPP_VERSION_MAJOR})
162+endif()
163+
164 target_include_directories(grpcpp_channelz
165 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
166 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
Brad Bishop63ae8782019-10-09 09:56:13 -0400167@@ -5367,6 +5427,10 @@ if(WIN32 AND MSVC)
Brad Bishop316dfdd2018-06-25 12:45:53 -0400168 endif()
169 endif()
170
171+if(_gRPC_PLATFORM_LINUX)
172+ set_property(TARGET grpc_csharp_ext PROPERTY VERSION ${CSHARP_VERSION})
173+ set_property(TARGET grpc_csharp_ext PROPERTY SOVERSION ${CSHARP_VERSION_MAJOR})
174+endif()
175
176 target_include_directories(grpc_csharp_ext
177 PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>