Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt5LinguistTools cmake BYPRODUCTS declaration



  • Hi :-)

    I create translations for a Qt program built via CMake like this (excerpt of My CMakeLists.txt):

    set(trPlural_SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/src/ExportPlayersDialog.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/src/ImportPlayersDialog.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/src/PlayersPage.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/src/ScorePage.cpp
    )
    
    set(TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/muckturnier_de.ts)
    qt5_create_translation(QM_FILES ${trPlural_SOURCES} ${TS_FILES}
                        OPTIONS -pluralonly -locations none)
    add_custom_target(Localization ALL DEPENDS ${QM_FILES})
    

    This works fine if the default generator (Unix Makefiles) is used. But when I generate for Ninja (cmake -G Ninja) it complains about a missing BYPRODUCTS declaration:

    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/muckturnier_de_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 really a build system pro, but apparently, the custom command is defined inside the qt5_create_translation macro (to be found in Qt5LinguistToolsMacros.cmake).

    So here's my question: Can this be fixed inside my CMakeLists.txt, or is this an upstream issue to be fixed inside the macros that Qt5LinguistTools ship?

    Cheers, Tobias


  • Lifetime Qt Champion

    Hi,

    Which version of CMake and Qt are you using ?



  • CMake 3.9.6. Happened both with Qt 5.9.6 and 5.11.1.


  • Lifetime Qt Champion

    You should check the bug report system to see if there's already something related. If not, please consider opening a feature request providing a minimal compilable example that shows that behaviour.



  • Thanks for the feedback, I opened Bug #71354.


Log in to reply