xref: /aosp_15_r20/external/protobuf/cmake/libprotobuf-lite.cmake (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1set(libprotobuf_lite_files
2  ${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc
3  ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc
4  ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc
5  ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc
6  ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc
7  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc
8  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite.cc
9  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc
10  ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc
11  ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.cc
12  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc
13  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc
14  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc
15  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc
16  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc
17  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
18  ${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc
19  ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc
20  ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc
21  ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc
22  ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc
23  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.cc
24  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc
25  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128.cc
26  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.cc
27  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.cc
28  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.cc
29  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.cc
30  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid.cc
31  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.cc
32  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.cc
33  ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc
34)
35
36set(libprotobuf_lite_includes
37  ${protobuf_SOURCE_DIR}/src/google/protobuf/any.h
38  ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h
39  ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h
40  ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h
41  ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h
42  ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h
43  ${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h
44  ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h
45  ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h
46  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h
47  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h
48  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h
49  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h
50  ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h
51  ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h
52  ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h
53  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h
54  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h
55  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h
56  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h
57  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h
58  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
59  ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h
60  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry_lite.h
61  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h
62  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h
63  ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h
64  ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h
65  ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h
66  ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h
67  ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h
68  ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h
69  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.h
70  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h
71  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/casts.h
72  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h
73  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/hash.h
74  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h
75  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/macros.h
76  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/map_util.h
77  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mutex.h
78  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/once.h
79  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h
80  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h
81  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.h
82  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stl_util.h
83  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h
84  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.h
85  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util.h
86  ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h
87)
88
89add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
90  ${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${protobuf_version_rc_file})
91if(protobuf_HAVE_LD_VERSION_SCRIPT)
92  if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
93    target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
94  elseif(protobuf_BUILD_SHARED_LIBS)
95    target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
96  endif()
97  set_target_properties(libprotobuf-lite PROPERTIES
98    LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
99endif()
100target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
101if(protobuf_LINK_LIBATOMIC)
102  target_link_libraries(libprotobuf-lite PRIVATE atomic)
103endif()
104if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
105  target_link_libraries(libprotobuf-lite PRIVATE log)
106endif()
107target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src)
108if(protobuf_BUILD_SHARED_LIBS)
109  target_compile_definitions(libprotobuf-lite
110    PUBLIC  PROTOBUF_USE_DLLS
111    PRIVATE LIBPROTOBUF_EXPORTS)
112endif()
113set_target_properties(libprotobuf-lite PROPERTIES
114    VERSION ${protobuf_VERSION}
115    SOVERSION 32
116    OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
117    DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
118add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
119