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

CMake macro qt_add_resource does not handle <file> tokens in comments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.5, 6.4.3
    • Build System: CMake
    • None
    • All

    Description

      I’m trying to use CMake macro qt_add_resources, and add qrc file that has comments, and it seems this generates rules including the comments as dependencies.

      Example:
      resources.qrc

      <!-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
           +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
           my quoted comment is here "<file>"s after quoted comment
           +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      -->
      <RCC>
          <qresource prefix="/guiResources">
             <file>fnGettingStarted.txt</file>
      <!-- EXAMPLE OF USING FILE ALIAS
             <file alias="bang.svg">images/bangCircleYellow.svg</file>
      -->
          </qresource>
      </RCC>
      

      CMakeLists.txt

      cmake_minimum_required(VERSION 3.18)
      project(hello_qrc VERSION 1.0)
      
      find_package(Qt5 REQUIRED COMPONENTS Core Gui)
      
      qt_add_resources(SOURCES resources.qrc)
      
      add_library(lib ${SOURCES})
      

      This is the error during cmake --build build -t lib:

      ninja: error: '/home/abdelmak/sandbox/cmake/rcc/"s after quoted comment     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->/home/abdelmak/sandbox/cmake/rcc/fnGettingStarted.txt', needed by '/home/abdelmak/sandbox/cmake/rcc/build/qrc_resources.cpp', missing and no known rule to make it
      

      If I remove the upper comment and keep the comment at the end, it errors also with:

      ninja: error: '/home/abdelmak/sandbox/cmake/rcc/images/bangCircleYellow.svg', needed by '/home/abdelmak/sandbox/cmake/rcc/build/qrc_resources.cpp', missing and no known rule to make it
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            abdelmaged Abdelmaged Khalifa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes