[CMake] Seemingly-unfixable warning about CMP0058 after upgrade to CMake 3.3

Michael Catanzaro mcatanzaro at gnome.org
Sun Sep 27 20:47:32 EDT 2015


Hi,

After upgrading to CMake 3.3, I'm seeing this warning when running
CMake on WebKitGTK+:

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:

   DerivedSources/webkit2gtk/WebKit2ResourcesGResourceBundle.xml

  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.


But DerivedSources/webkit2gtk/WebKit2ResourcesGResourceBundle.xml is
not generated by add_custom_command or add_custom_target, it's
generated by the file command (in
WebKit/Source/WebKit2/PlatformGTK.cmake [1]):

file(WRITE
${DERIVED_SOURCES_WEBKIT2GTK_DIR}/WebKit2ResourcesGResourceBundle.xml
    "<?xml version=1.0 encoding=UTF-8?>\n"
    "<gresources>\n"
    "    <gresource prefix=\"/org/webkitgtk/resources\">\n"
    ${WebKit2Resources}
    "    </gresource>\n"
    "</gresources>\n"
)

So there's no way to specify it as a BYPRODUCT. This seems like a
defect in CMake, unless I am missing something...? It's building fine,
so not a big deal; just would be nice to get rid of the warning.

Michael

[1] https://github.com/WebKit/webkit/blob/master/Source/WebKit2/Platfor
mGTK.cmake


More information about the CMake mailing list