CMakeLists.txt 941 B

1234567891011121314151617181920212223242526272829
  1. set(TARGET qtprotobuf_plugin_test)
  2. include(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufTest.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} PRIVATE gtest_main gtest ${QT_PROTOBUF_PROJECT}::QtProtobuf ${QT_PROTOBUF_PROJECT}::QtGrpc Qt5::Core Qt5::Test Qt5::Network ${CMAKE_THREAD_LIBS_INIT})
  14. qtprotobuf_link_archive(${TARGET} qtprotobuf_test_qtprotobuf_gen)
  15. add_target_windeployqt(TARGET ${TARGET}
  16. QML_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  17. add_subdirectory("serialization")
  18. add_test(NAME ${TARGET} COMMAND ${TARGET})
  19. set_tests_properties(${TARGET} PROPERTIES
  20. ENVIRONMENT QT_PROTOBUF_PLUGIN_PATH=$<TARGET_FILE_DIR:serializationplugin>)