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

Qt5LinguistTools CMake scripts don't declare BYPRODUCTS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.4
    • 5.11.1
    • Build System: CMake
    • None
    • 1b006ab3d8954efcaa76a1768b31df01e133f34d

    Description

      When cmake generates for Ninja using a Qt5LinguistTools cmake script, it complains about missing BYPRODUCTS declarations.

      Here's a minimal example:

      CMakeLists.txt:

      cmake_minimum_required(VERSION 3.2.0)
      project(ninja_complaint)
      
      find_package(Qt5 COMPONENTS Core)
      include_directories(${Qt5Core_INCLUDES})
      find_package(Qt5LinguistTools)
      
      set(SOURCES main.cpp)
      
      set(TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/ninja_complaint_en.ts)
      qt5_create_translation(QM_FILES ${SOURCES} ${TS_FILES})
      add_custom_target(Localization ALL DEPENDS ${QM_FILES})
      
      add_executable(ninja_complaint ${SOURCES})
      target_link_libraries(ninja_complaint ${Qt5Core_LIBRARIES})
      

       
      main.cpp:

      #include <QObject>
      #include <QDebug>
      
      int main(int argc, char* argv[])
      {
          qDebug() << QObject::tr("Some text");
      }
      

      When you generate Ninja makefiles via "cmake -G Ninja", the following warning is displayed:

      CMake Warning (dev):
      Policy CMP0058 is not set: Ninja requires custom command byproducts to be
      explicit. Run "cmake --help-policy CMP0058" for policy details. Use the
      cmake_policy command to set the policy and suppress this warning.
      This project specifies custom command DEPENDS on files in the build tree
      that are not specified as the OUTPUT or BYPRODUCTS of any
      add_custom_command or add_custom_target:
      CMakeFiles/ninja_complaint_en_lst_file
      For compatibility with versions of CMake that did not have the BYPRODUCTS
      option, CMake is generating phony rules for such files to convince 'ninja'
      to build.
      Project authors should add the missing BYPRODUCTS or OUTPUT options to the
      custom commands that produce these files.
      This warning is for project developers. Use -Wno-dev to suppress it.
      

       
      I'm not a build system pro, but as far as I can grasp it, the BYPRODUCTS declaration should be done inside the cmake scripts that Qt5LinguistTools provide, in this case the qt5_create_translation macro.

      Maybe you want to fix this?

      Attachments

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

        Activity

          People

            kkohne Kai Köhne
            l3u Tobias Leupold
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes