Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-125329

Grpc generators: fix Policy CMP0071

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.7.0, 6.8.0 FF
    • Build System: CMake, GRPC
    • None
    • 0c1b25107 (dev), 02344f5c9 (6.8), 19c5ae8a0 (6.7)

    Description

      When using the generators in a minimal setup like this:

      cmake_minimum_required(VERSION 3.9)
      project(GrpcPreset LANGUAGES CXX)
      
      set(CMAKE_CXX_STANDARD 20)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      # cmake_policy(SET CMP0071 NEW)
      find_package(Qt6 REQUIRED COMPONENTS Grpc)
      qt_standard_project_setup()
      
      qt_add_executable(qtclient src/qtclient.cpp)
      
      qt_add_protobuf(qtclient
          PROTO_FILES ${proto_file}
          PROTO_INCLUDES ${proto_imp}
          OUTPUT_DIRECTORY "${proto_out}/qt"
      )
      
      qt_add_grpc(qtclient CLIENT
          PROTO_FILES ${proto_file}
          PROTO_INCLUDES ${proto_imp}
          OUTPUT_DIRECTORY "${proto_out}/qt"
      )
      
      target_link_libraries(qtclient PRIVATE Qt6::Grpc)
      target_include_directories(qtclient
          PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
      )
      
      

      then cmake complains about the CMP0071 policy as it will exclude the generated source files for compatibility. This should happen implicitly so that users don't have to set the policy.

      ❯ cmake --version
      cmake version 3.29.2

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-125329
          # Subject Branch Project Status CR V

          Activity

            People

              semlanik Alexey Edelev
              dennisoberst Dennis Oberst
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes