Fix Ruby FFI to pass `MiniTable` to `upb_Message_New()` aka `new_message_from_def()`.
[google-protobuf.git] / cmake / libupb.cmake
blob7476e56eb788c99cb0af85efd92dafba70d8d28d
1 # CMake definitions for libupb.
3 include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
4 include(${protobuf_SOURCE_DIR}/cmake/protobuf-configure-target.cmake)
6 set(bootstrap_cmake_dir ${protobuf_SOURCE_DIR}/upb/reflection/cmake)
7 set(bootstrap_sources
8   # Hardcode bootstrap paths
9   ${bootstrap_cmake_dir}/google/protobuf/descriptor.upb.h
10   ${bootstrap_cmake_dir}/google/protobuf/descriptor.upb_minitable.h
11   ${bootstrap_cmake_dir}/google/protobuf/descriptor.upb_minitable.c
14 # Note: upb does not support shared library builds, and is intended to be
15 # statically linked as a private dependency.
16 add_library(libupb STATIC
17   ${libupb_srcs}
18   ${libupb_hdrs}
19   ${bootstrap_sources}
20   ${protobuf_version_rc_file}
23 target_include_directories(libupb PUBLIC
24   $<BUILD_INTERFACE:${bootstrap_cmake_dir}>
25   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
28 protobuf_configure_target(libupb)
30 set_target_properties(libupb PROPERTIES
31     VERSION ${protobuf_VERSION}
32     OUTPUT_NAME ${LIB_PREFIX}upb
33     DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}"
34     # For -fvisibility=hidden and -fvisibility-inlines-hidden
35     C_VISIBILITY_PRESET hidden
36     CXX_VISIBILITY_PRESET hidden
37     VISIBILITY_INLINES_HIDDEN ON
39 add_library(protobuf::libupb ALIAS libupb)
40 target_link_libraries(libupb PRIVATE utf8_range)