CMakeLists.txt 850 B

123456789101112131415161718192021222324
  1. cmake_minimum_required(VERSION 2.8)
  2. project(SnakeSimulatorkUi LANGUAGES CXX)
  3. find_package(Qt5 COMPONENTS Quick Gui Core Qml REQUIRED)
  4. set(QT_PROTOBUF_MAKE_TESTS OFF CACHE BOOL "" FORCE)
  5. set(QT_PROTOBUF_MAKE_EXAMPLES OFF CACHE BOOL "" FORCE)
  6. add_subdirectory("qtprotobuf")
  7. find_package(QtProtobufProject CONFIG COMPONENTS QtProtobuf QtGrpc REQUIRED)
  8. if(Qt5_POSITION_INDEPENDENT_CODE)
  9. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  10. endif()
  11. file(GLOB PROTO_FILES ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}/../snakesimulator/snakesimulator.proto")
  12. set(CMAKE_AUTOMOC ON)
  13. set(CMAKE_AUTORCC ON)
  14. add_executable(SnakeSimulatorkUi main.cpp qml.qrc clientwrapper.cpp)
  15. qtprotobuf_generate(TARGET SnakeSimulatorkUi PROTO_FILES ${PROTO_FILES} QML)
  16. target_link_libraries(SnakeSimulatorkUi PRIVATE Qt5::Gui QtProtobufProject::QtProtobuf QtProtobufProject::QtGrpc)