xref: /aosp_15_r20/external/protobuf/cmake/libprotobuf.cmake (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1*1b3f573fSAndroid Build Coastguard Workerset(libprotobuf_files
2*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc
3*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc
4*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc
5*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc
6*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc
7*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc
8*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc
9*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc
10*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc
11*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc
12*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.cc
13*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc
14*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.cc
15*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc
16*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc
17*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.cc
18*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc
19*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc
20*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc
21*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc
22*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc
23*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc
24*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc
25*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.cc
26*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.cc
27*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.cc
28*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc
29*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.cc
30*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.cc
31*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc
32*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.cc
33*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc
34*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.cc
35*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.cc
36*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.cc
37*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.cc
38*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.cc
39*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.cc
40*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.cc
41*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.cc
42*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.cc
43*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.cc
44*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource.cc
45*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter.cc
46*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info.cc
47*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/utility.cc
48*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.cc
49*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.cc
50*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.cc
51*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.cc
52*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc
53*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.cc
54*1b3f573fSAndroid Build Coastguard Worker)
55*1b3f573fSAndroid Build Coastguard Worker
56*1b3f573fSAndroid Build Coastguard Workerset(libprotobuf_includes
57*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.h
58*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.h
59*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.h
60*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.h
61*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h
62*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h
63*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h
64*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.h
65*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h
66*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.h
67*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h
68*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.h
69*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h
70*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h
71*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.h
72*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.h
73*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.h
74*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.h
75*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h
76*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h
77*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h
78*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/message.h
79*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h
80*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h
81*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h
82*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h
83*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h
84*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.h
85*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.h
86*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h
87*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.h
88*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.h
89*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h
90*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h
91*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h
92*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.h
93*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.h
94*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.h
95*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.h
96*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver.h
97*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.h
98*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h
99*1b3f573fSAndroid Build Coastguard Worker  ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.h
100*1b3f573fSAndroid Build Coastguard Worker)
101*1b3f573fSAndroid Build Coastguard Worker
102*1b3f573fSAndroid Build Coastguard Workeradd_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
103*1b3f573fSAndroid Build Coastguard Worker  ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${protobuf_version_rc_file})
104*1b3f573fSAndroid Build Coastguard Workerif(protobuf_HAVE_LD_VERSION_SCRIPT)
105*1b3f573fSAndroid Build Coastguard Worker  if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
106*1b3f573fSAndroid Build Coastguard Worker    target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
107*1b3f573fSAndroid Build Coastguard Worker  elseif(protobuf_BUILD_SHARED_LIBS)
108*1b3f573fSAndroid Build Coastguard Worker    target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
109*1b3f573fSAndroid Build Coastguard Worker  endif()
110*1b3f573fSAndroid Build Coastguard Worker  set_target_properties(libprotobuf PROPERTIES
111*1b3f573fSAndroid Build Coastguard Worker    LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map)
112*1b3f573fSAndroid Build Coastguard Workerendif()
113*1b3f573fSAndroid Build Coastguard Workertarget_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
114*1b3f573fSAndroid Build Coastguard Workerif(protobuf_WITH_ZLIB)
115*1b3f573fSAndroid Build Coastguard Worker  target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
116*1b3f573fSAndroid Build Coastguard Workerendif()
117*1b3f573fSAndroid Build Coastguard Workerif(protobuf_LINK_LIBATOMIC)
118*1b3f573fSAndroid Build Coastguard Worker  target_link_libraries(libprotobuf PRIVATE atomic)
119*1b3f573fSAndroid Build Coastguard Workerendif()
120*1b3f573fSAndroid Build Coastguard Workerif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
121*1b3f573fSAndroid Build Coastguard Worker  target_link_libraries(libprotobuf PRIVATE log)
122*1b3f573fSAndroid Build Coastguard Workerendif()
123*1b3f573fSAndroid Build Coastguard Workertarget_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
124*1b3f573fSAndroid Build Coastguard Workerif(protobuf_BUILD_SHARED_LIBS)
125*1b3f573fSAndroid Build Coastguard Worker  target_compile_definitions(libprotobuf
126*1b3f573fSAndroid Build Coastguard Worker    PUBLIC  PROTOBUF_USE_DLLS
127*1b3f573fSAndroid Build Coastguard Worker    PRIVATE LIBPROTOBUF_EXPORTS)
128*1b3f573fSAndroid Build Coastguard Workerendif()
129*1b3f573fSAndroid Build Coastguard Workerset_target_properties(libprotobuf PROPERTIES
130*1b3f573fSAndroid Build Coastguard Worker    VERSION ${protobuf_VERSION}
131*1b3f573fSAndroid Build Coastguard Worker    SOVERSION 32
132*1b3f573fSAndroid Build Coastguard Worker    OUTPUT_NAME ${LIB_PREFIX}protobuf
133*1b3f573fSAndroid Build Coastguard Worker    DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
134*1b3f573fSAndroid Build Coastguard Workeradd_library(protobuf::libprotobuf ALIAS libprotobuf)
135