File 0001-cmake-Add-descriptor_upbproto-library-for-shared-lin.patch of Package upb

From 5e932b064d43b02bdf1534d769ceb8800d5f7358 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <mrostecki@opensuse.org>
Date: Mon, 4 Nov 2019 11:19:09 +0100
Subject: [PATCH 1/5] cmake: Add descriptor_upbproto library for shared linking
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Before this change, building upb with the -DBUILD_SHARED_LIBS:BOOL=ON
option was failing due to lack of libdescriptor_upbproto.so shared
library. Example:

```
$ mkdir build
$ cd build/
$ cmake -DBUILD_SHARED_LIBS:BOOL=ON ..
[...]
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mrostecki/repos/upb/build
$ make
[...]
Scanning dependencies of target reflection
[ 30%] Building C object CMakeFiles/reflection.dir/upb/def.c.o
[ 34%] Building C object CMakeFiles/reflection.dir/upb/msgfactory.c.o
[ 38%] Linking C shared library libreflection.so
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -ldescriptor_upbproto
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/reflection.dir/build.make:100: libreflection.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:215: CMakeFiles/reflection.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
```

This change makes sure that the descriptor_upbproto library exists.
Behavior for static libraries seems to be unchanged.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 836c5ff..6a8552e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,6 +78,9 @@ add_library(upb
 add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE)
 target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
   upb)
+add_library(descriptor_upbproto
+  generated_for_cmake/google/protobuf/descriptor.upb.c
+  generated_for_cmake/google/protobuf/descriptor.upb.h)
 add_library(reflection
   upb/def.c
   upb/msgfactory.c
-- 
2.16.4

openSUSE Build Service is sponsored by