CMakeLists.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. qt_protobuf_extract_qt_variable(QT_INSTALL_PLUGINS)
  2. if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/3rdparty/microjson/CMakeLists.txt")
  3. set(MICROJSON_MAKE_TESTS OFF)
  4. set(MICROJSON_OBJECT_LIB_ONLY ON)
  5. add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/microjson")
  6. message(STATUS "Using microjson from 3rdparty")
  7. else()
  8. message(FATAL_ERROR "microjson is not found.")
  9. endif()
  10. qt_protobuf_internal_add_library(Protobuf
  11. SOURCES
  12. qtprotobuf.cpp
  13. qtprotobuflogging.cpp
  14. qprotobufserializerregistry.cpp
  15. qabstractprotobufserializer.cpp
  16. qprotobufjsonserializer.cpp
  17. qprotobufserializer.cpp
  18. qprotobufmetaproperty.cpp
  19. qprotobufmetaobject.cpp
  20. qtprotobufglobal.h
  21. qtprotobuftypes.h
  22. qtprotobuflogging.h
  23. qprotobufobject.h
  24. qprotobufserializerregistry_p.h
  25. qqmllistpropertyconstructor.h
  26. qabstractprotobufserializer.h
  27. qabstractprotobufserializer_p.h
  28. qprotobufserializer.h
  29. qprotobufserializer_p.h
  30. qprotobufjsonserializer.h
  31. qprotobufselfcheckiterator.h
  32. qprotobufmetaproperty.h
  33. qprotobufmetaobject.h
  34. qprotobufserializationplugininterface.h
  35. qprotobuflazymessagepointer.h
  36. PUBLIC_HEADER
  37. qtprotobufglobal.h
  38. qtprotobuftypes.h
  39. qtprotobuflogging.h
  40. qprotobufobject.h
  41. qqmllistpropertyconstructor.h
  42. qabstractprotobufserializer.h
  43. qabstractprotobufserializer_p.h
  44. qprotobufserializer.h
  45. qprotobufjsonserializer.h
  46. qprotobufselfcheckiterator.h
  47. qprotobufmetaproperty.h
  48. qprotobufmetaobject.h
  49. qprotobufserializationplugininterface.h
  50. qprotobuflazymessagepointer.h
  51. PUBLIC_LIBRARIES
  52. Qt6::Core
  53. Qt6::Qml
  54. PUBLIC_DEFINES
  55. QT_PROTOBUF_PLUGIN_PATH="${QT_INSTALL_PLUGINS}/protobuf"
  56. )
  57. qtprotobuf_link_target(Protobuf microjson)
  58. set_target_properties(Protobuf PROPERTIES
  59. QT_PROTOBUF_PLUGIN_PATH "${QT_INSTALL_PLUGINS}/protobuf"
  60. )
  61. set_property(TARGET Protobuf APPEND PROPERTY EXPORT_PROPERTIES QT_PROTOBUF_PLUGIN_PATH)
  62. if(NOT BUILD_SHARED_LIBS)
  63. set(QT_PROTOBUF_EXTRA_COMPILE_DIFINITIONS QT_PROTOBUF_STATIC)
  64. set(QT_PROTOBUF_EXTRA_CONFIG "staticlib") # extra config for .pri file in case if static
  65. # build enabled
  66. endif()
  67. qt_protobuf_internal_generate_pri(Protobuf)
  68. if(TARGET Qt6::Quick)
  69. add_subdirectory("quick")
  70. endif()