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

Specifying RESOURCES to qt6_target_qml_sources does not make file level dependency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 6.2.10, 6.5.2, 6.6.0
    • 6.5.0
    • Build System: CMake
    • None
    • Linux archlinux 6.3.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 01 May 2023 17:42:39 +0000 x86_64 GNU/Linux
    • Linux/X11
    • 4ffea9dd1 (dev), 1c2203bcc (6.5), 8133cba37 (tqtc/lts-6.2)

      I generate .spv for shaders using add_custom_command CMake's functionality (this script, used here). Resulting filepaths of .spv files are generated ABSOLUTE (because of GLOB_RECURSE). I add .spv files to QML module using RESOURCES parameter of qt6_target_qml_sources macro (this). In 6.3 or 6.2 all was fine: file level dependencies works fine. But in 6.5 I get an error:

       

      CMake Error at /usr/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:2032 (file):
        file COPY_FILE failed to copy
          /home/anatoliy/Projects/sah_kd_tree/src/viewer/shaders/barycentric_color.frag.debug.spv
        to
          /home/anatoliy/Projects/build-sah_kd_tree-Desktop-Debug/src/viewer/lib/shaders/barycentric_color.frag.spv
        because: No such file or directory (input)
      Call Stack (most recent call first):
        src/viewer/CMakeLists.txt:81 (qt6_target_qml_sources) 

       

      Definitely there is some regression in CMake machinery of Qt in the last releases.

       

      Instead of copying here I advice to use add_custom_command like I fix it locally (see in attachment). Correctness should not be sacrificed in the sake of "significant increase in copying speed".

      Your developers should know difference between how CMakeLists.txt is interpreted at (so called) "configure step" and at "generate step" and what is the difference between file COPY_FILE or execute_process COMMAND on the one hand and add_custom_command, add_custom_target and add_dependency on the other hand, before they made such an changes.

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

            semlanik Alexey Edelev
            tomilovanatoliy Anatoliy Tomilov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes