CMakeLists.txt 908 B

12345678910111213141516171819202122232425262728
  1. set(TARGET qtprotobuf_plugin_test)
  2. include(${QTPROTOBUF_CMAKE_DIR}/QtProtobufCommon.cmake)
  3. find_package(Threads REQUIRED)
  4. find_package(Qt5 COMPONENTS Test REQUIRED)
  5. file(GLOB SOURCES
  6. serializationplugintest.cpp)
  7. if(Qt5_POSITION_INDEPENDENT_CODE)
  8. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  9. endif()
  10. set(CMAKE_CXX_STANDARD 14)
  11. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  12. add_executable(${TARGET} ${SOURCES})
  13. target_link_libraries(${TARGET} gtest_main gtest ${QtProtobuf_GENERATED} ${QTPROTOBUF_COMMON_NAMESPACE}::QtProtobuf ${QTPROTOBUF_COMMON_NAMESPACE}::QtGrpc Qt5::Core Qt5::Test Qt5::Network ${CMAKE_THREAD_LIBS_INIT})
  14. add_target_windeployqt(TARGET ${TARGET}
  15. QML_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  16. add_subdirectory("serialization")
  17. add_test(NAME ${TARGET} COMMAND ${TARGET})
  18. set_tests_properties(${TARGET} PROPERTIES
  19. ENVIRONMENT QT_PROTOBUF_PLUGIN_PATH=$<TARGET_FILE_DIR:serializationplugin>)