• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# CMake definitions for libupb.
2
3include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
4include(${protobuf_SOURCE_DIR}/cmake/protobuf-configure-target.cmake)
5
6set(bootstrap_cmake_dir ${protobuf_SOURCE_DIR}/upb/reflection/cmake)
7set(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
12)
13
14# Note: upb does not support shared library builds, and is intended to be
15# statically linked as a private dependency.
16add_library(libupb STATIC
17  ${libupb_srcs}
18  ${libupb_hdrs}
19  ${bootstrap_sources}
20  ${protobuf_version_rc_file}
21)
22
23target_include_directories(libupb PUBLIC
24  $<BUILD_INTERFACE:${bootstrap_cmake_dir}>
25  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
26)
27
28protobuf_configure_target(libupb)
29
30set_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
38)
39add_library(protobuf::libupb ALIAS libupb)
40target_link_libraries(libupb PRIVATE utf8_range)
41