[cmake-developers] CMP0071

Sebastian Holtermann seblist at xwmw.org
Thu Oct 5 03:31:53 EDT 2017


On Mittwoch, 4. Oktober 2017 20:01:50 CEST clinton at elemtech.com wrote:
> ----- On Sep 26, 2017, at 9:07 AM, Sebastian Holtermann seblist at xwmw.org 
wrote:
> >> I updated and I'm getting this:
> >> 
> >> CMake Warning (dev) in claro/navigation5/CMakeLists.txt:
> >> Policy CMP0071 is not set: Let AUTOMOC and AUTOUIC process GENERATED
> >> files.
> >> Run "cmake --help-policy CMP0071" for policy details. Use the
> >> cmake_policy
> >> command to set the policy and suppress this warning.
> >> 
> >> AUTOMOC: Ignoring GENERATED header file(s):
> >> 
> >> "/path/to/ui_SomeFile.h"
> >> "/path/to/qrc_AnotherFile.cpp"
> >> 
> >> 
> >> Those ui_* and qrc_* files do not require processing by moc.
> >> In this case, I was using qt5_wrap_ui() and qt5_add_resources().
> >> 
> >> I did an experiment and replaced qt5_wrap_ui() with autouic, and the
> >> warning went away for those ui_* files.
> >> 
> >> Is there a way to not print out that policy warning on ui_* and qrc_*
> >> files
> >> when using qt5_wrap_ui()/qt5_add_resources()? These are the only file
> >> types
> >> for which I'm getting that warning.
> > 
> > You can set the source file property SKIP_AUTOMOC on the GENERATED files.
> > See: https://cmake.org/cmake/help/v3.9/prop_sf/SKIP_AUTOMOC.html
> > See: https://cmake.org/cmake/help/git-master/policy/CMP0071.html
> > 
> > For example like this
> > ```
> > set_property(SOURCE /path/to/ui_SomeFile.h PROPERTY SKIP_AUTOMOC ON)
> > set_property(SOURCE /path/to/qrc_AnotherFile.cpp PROPERTY SKIP_AUTOMOC ON)
> > ```
> 
> I'm probably pushing things here, but why not.
> I'm experimenting with setting AUTOMOC/AUTOUIC/AUTORCC on, and also using
> the qt5_* macros.
> 
> I see the rcc processing only looks at *.qrc files, but the uic processing
> looks at files with any extension.  Why not limit that to just *.ui files? 
> I find myself setting SKIP_AUTOUIC on *.h and *.cpp files to silence
> CMP0071 warnings.  Its obvious to me that a .cpp or .h file is not an xml
> file as expected by uic.
> 
> I can understand having to set SKIP_AUTOMOC on files with various file
> extensions.
> 
> I bring this up here in case something needs to change on the CMake side.

Despite it's name might imply that, AUTOUIC doesn't care about .ui files in the 
target sources. It never did.

AUTOUIC probes the same files as AUTOMOC, that is .h(xx/pp) and .c(xx/pp) files. 
In these files it searches for '#include "ui_<BASE>.h"' strings and derives the 
<BASE>.ui file names from that (for uic processing).

I don't think that this can (or should) be changed. It's a reasonable behavior 
and a number of projects rely on it. It just is not what people might expect 
at a first glance.







More information about the cmake-developers mailing list