libprotoc.cmake 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. set(libprotoc_files
  2. ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc
  3. ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc
  4. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc
  5. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
  6. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc
  7. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc
  8. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc
  9. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc
  10. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc
  11. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc
  12. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc
  13. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
  14. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
  15. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
  16. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
  17. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
  18. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
  19. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
  20. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc
  21. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
  22. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
  23. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc
  24. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
  25. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
  26. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc
  27. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
  28. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
  29. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
  30. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
  31. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
  32. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
  33. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
  34. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
  35. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc
  36. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc
  37. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc
  38. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc
  39. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc
  40. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc
  41. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc
  42. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc
  43. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc
  44. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc
  45. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
  46. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
  47. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
  48. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
  49. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
  50. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
  51. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
  52. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc
  53. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc
  54. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc
  55. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc
  56. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc
  57. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc
  58. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc
  59. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
  60. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc
  61. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc
  62. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
  63. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
  64. ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
  65. ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
  66. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
  67. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
  68. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
  69. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc
  70. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc
  71. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
  72. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
  73. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
  74. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc
  75. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
  76. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
  77. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
  78. ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc
  79. ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc
  80. ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
  81. ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc
  82. ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
  83. ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
  84. ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
  85. )
  86. set(libprotoc_headers
  87. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h
  88. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h
  89. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h
  90. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h
  91. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
  92. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
  93. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h
  94. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h
  95. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h
  96. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
  97. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
  98. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
  99. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
  100. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
  101. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
  102. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h
  103. ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h
  104. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
  105. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h
  106. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h
  107. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h
  108. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h
  109. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h
  110. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h
  111. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h
  112. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
  113. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
  114. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
  115. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
  116. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
  117. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
  118. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
  119. ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
  120. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h
  121. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h
  122. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h
  123. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
  124. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h
  125. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h
  126. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h
  127. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h
  128. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h
  129. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
  130. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
  131. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
  132. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h
  133. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h
  134. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h
  135. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h
  136. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h
  137. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h
  138. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h
  139. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h
  140. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h
  141. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h
  142. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h
  143. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h
  144. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h
  145. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h
  146. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h
  147. ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h
  148. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
  149. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
  150. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
  151. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
  152. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
  153. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
  154. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
  155. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
  156. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
  157. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
  158. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
  159. ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
  160. ${protobuf_source_dir}/src/google/protobuf/compiler/scc.h
  161. ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
  162. ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
  163. )
  164. if (MSVC)
  165. set(libprotoc_rc_files
  166. ${CMAKE_CURRENT_BINARY_DIR}/version.rc
  167. )
  168. endif()
  169. add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
  170. ${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files})
  171. target_link_libraries(libprotoc libprotobuf)
  172. if(MSVC AND protobuf_BUILD_SHARED_LIBS)
  173. target_compile_definitions(libprotoc
  174. PUBLIC PROTOBUF_USE_DLLS
  175. PRIVATE LIBPROTOC_EXPORTS)
  176. endif()
  177. set_target_properties(libprotoc PROPERTIES
  178. COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
  179. VERSION ${protobuf_VERSION}
  180. OUTPUT_NAME ${LIB_PREFIX}protoc
  181. DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
  182. add_library(protobuf::libprotoc ALIAS libprotoc)