MantisBT - CMake
View Issue Details
0008646CMakeModulespublic2009-03-01 17:082016-06-10 14:30
Conrad 
Clinton Stimpson 
normalfeaturealways
closedmoved 
CMake-2-6 
 
0008646: UseQt4: Make adding various Qt module INCLUDE_DIRECTORIES optional
Qt4 now supports framework-style includes, e.g.:
#include <QtGui/QLabel>
#include <QtCore/QString>
#include <QtNetwork/QHttp>

When using framework-style includes, it is not necessary to add each individual Qt module's include directory to the INCLUDE path; only QTDIR/include needs to be in the INCLUDE path.

However, UseQt4.cmake automatically adds the path for each individual module being used with the line:
        INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
Projects using framework-style includes do not need this; it makes compile lines longer, can slow compilation time (albeit slightly), and prevents us from enforcing the use of Qt framework-style includes within our project.

I'd suggest a simple boolean option variable like QT_FRAMEWORK_STYLE_INCLUDES which, if defined, would skip the above single line in UseQt4.cmake. However, perusing the bugs I see a brand new COMPONENT style FindQt4.cmake, which looks fantastic and I really look forward to using it! So perhaps this would better be specified as a keyword/option to the new COMPONENTS-style version of FindQt4?

In our local installations, we've simply commented out the "INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})" in our CMake installation's share\cmake-2.6\Modules\UseQt4.cmake file, and everything works as desired.

No tags attached.
Issue History
2009-03-01 17:08ConradNew Issue
2009-03-01 17:20Bill HoffmanStatusnew => assigned
2009-03-01 17:20Bill HoffmanAssigned To => Clinton Stimpson
2010-05-09 04:09Alex NeundorfCategoryCMake => Modules
2012-08-13 23:25Clinton StimpsonStatusassigned => backlog
2013-11-02 09:49Stephen KellyNote Added: 0034319
2016-06-10 14:27Kitware RobotNote Added: 0041507
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0034319)
Stephen Kelly   
2013-11-02 09:49   
This bug should be closed.

Even if a project use only framework style includes, the dependencies do not necessarily do so. The other include directories are needed in that case.

Additionally, it is not stated why the extra -I is a problem.
(0041507)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.