diff options
author | Francois Ferrand <thetypz@gmail.com> | 2016-10-06 12:07:29 +0200 |
---|---|---|
committer | Francois Ferrand <thetypz@gmail.com> | 2017-08-25 12:15:36 +0000 |
commit | fabedd399ebe4d28d6eb62c8a863f1bbcce78d3a (patch) | |
tree | dc38ba0a7d801af8998af38d4032334a2880e104 /qmake | |
parent | a980250a666bc87e5db006b8668c6af9340915f2 (diff) |
Introduce OBJECTIVE_HEADERS
When a ObjC++ QObject subclass is listed in the regular HEADERS, qmake
creates a .cpp file. The moc file will then fail to compile, as it
requries ObjC++ headers. Using Q_FORWARD_DECLARE_OBJC_CLASS() can be
used to let the class be parsed by The compiler, but link will still
fail, as the generated methods (e.g. signals) must be built with ObjC++
compiler, in case they have ObjC parameters:
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
class MyClass: public QObject {
Q_OBJECT
signals:
void objcSignal(NSString * myObj);
};
The canonical workaround for that is including the .cpp file into the
corresponding .mm file. This also offers a compilation speed advantage,
but is somewhat counter-intuitive.
Therefore, we introduce a separate variable which instructs moc to create
.mm files directly.
Task-number: QTBUG-1581
Change-Id: Ia98af58006efd168ea37f3a63c396979e7e81baa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index c9759fa517..8133f8771e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1324,6 +1324,30 @@ \snippet code/doc_src_qmake-manual.pro 40 + \target OBJECTIVE_HEADERS + \section1 OBJECTIVE_HEADERS + + Defines the Objective-C++ header files for the project. + + qmake automatically detects whether \l{moc} is required by the classes in the + headers, and adds the appropriate dependencies and files to the project for + generating and linking the moc files. + + This is similar to the HEADERS variable, but will let the generated moc + files be compiled with the Objective-C++ compiler. + + See also \l{#OBJECTIVE_SOURCES}{OBJECTIVE_SOURCES}. + + \target OBJECTIVE_SOURCES + \section1 OBJECTIVE_SOURCES + + Specifies the names of all Objective-C/C++ source files in the project. + + This variable is now obsolete, Objective-C/C++ files (.m and .mm) can be + added to the \l{#SOURCES}{SOURCES} variable. + + See also \l{#OBJECTIVE_HEADERS}{OBJECTIVE_HEADERS}. + \target OBJECTS \section1 OBJECTS |