[Development] CMake integration and system headers

Kurt Pattyn pattyn.kurt at gmail.com
Wed May 7 10:59:21 CEST 2014

On 06 May 2014, at 11:40, Mikołaj Siedlarek <msiedlarek at nctz.net> wrote:

> Hi,
> I’m on a quest to enable hack-free all-warnings-enabled building of my project using, among others,
> Qt and CMake. This requires that compiler treat Qt headers included in my code as “system headers”
> and not warn me about constructs used in them.
> I already contributed -iframework (Apple frameworks counterpart to -isystem) flag support to CMake
> (https://github.com/Kitware/CMake/pull/100), so with 3.0 version it should correctly handle properly
> marked include directories on all systems.
> The only problem is current CMake integration in Qt uses INTERFACE_INCLUDE_DIRECTORIES
> target property, when to be provide a system include directory it should use
> INTERFACE_SYSTEM_INCLUDE_DIRECTORIES. On compilers that do not support -isystem flag
> CMake falls back to -I, so compatibility would not be a problem.
> The problem is current CMake integration in Qt requires version 2.8.3, but
> INTERFACE_SYSTEM_INCLUDE_DIRECTORIES is only available since 2.8.12. Before I propose
> a patch I’d like to consult a maintainer of this system, or at least someone more familiar with
> Qt release process, whether it’s best to add some CMake version checks or version requirement
> can be bumped with next release.
> Please direct me to someone I can discuss this with, or tell me directly that my idea is bad.
It is a very good idea to have the Qt files treated as system files. I’ve gone to great lengths to
filter out the warnings from Qt in our CMake files. It would be nice if this was included out-of-the-box.
One problem that is not fixed by the system flag, is the auto-generated files (moc files).
For those I have submitted a patch that should appear in Qt 5.3.1.
Personally I would not force version 2.8.12 as AFAIK that version is not available out-of-the-box on Debian
for instance.


> Thanks,
> Mikołaj Siedlarek
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

More information about the Development mailing list