Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1
-
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
For Gerrit Dashboard: QTBUG-71354 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
257887,2 | CMake: Fix policy warning CMP0058 when using qt_create_translation(...) | 5.12 | qt/qttools | Status: MERGED | +2 | 0 |
319889,5 | CMake: Fix usage of qt_create_translation in a CTest | dev | qt/qttools | Status: MERGED | +2 | 0 |
320349,3 | CMake: Fix usage of qt_create_translation in a CTest | 5.15 | qt/qttools | Status: MERGED | +2 | 0 |