CMakeLists.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. Qt5::Core
  53. Qt5::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. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/qt_lib_protobuf.pri.in"
  68. "${QT_PROTOBUF_BINARY_DIR}/qt_lib_protobuf.pri" @ONLY
  69. )
  70. if(QT_PROTOBUF_INSTALL)
  71. qt_protobuf_extract_qt_variable(QT_HOST_DATA)
  72. install(FILES "${QT_PROTOBUF_BINARY_DIR}/qt_lib_protobuf.pri"
  73. DESTINATION "${CMAKE_INSTAL_PREFIX}${QT_HOST_DATA}/mkspecs/modules"
  74. COMPONENT dev
  75. )
  76. endif()
  77. if(TARGET Qt5::Quick)
  78. add_subdirectory("quick")
  79. endif()