Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
4.6.2
-
None
-
Linux
Description
Problem
qmake searches the source files for includes, but does no proper preprocessing. This means that conditional inclusions will break things:
#include "foo.h" int main( int argc, char* argv[] ) {Foo f;}
#ifndef FOO_H #define FOO_H class Foo { public: Foo(); }; #ifdef MERGE #warning MERGE is on #include "foo.cpp" // Comment out this line and anything is fine. #endif // MERGE #endif // FOO_H
#include "foo.h"
Foo::Foo() {}
Actual Results - of qmake
Relevant part of created Makefile:
SOURCES = main.cpp OBJECTS = main.o
Expected Results - of qmake
Relevant part of created Makefile:
SOURCES = foo.cpp \ main.cpp OBJECTS = foo.o \ main.o
Additional Information
The key point is the following: If you comment out #include "foo.cpp"
in foo.h you obtain the expected result, i.e. qmake adds foo.cpp
to the SOURCES variable in the Makefile.
Because the row with the statement #include "foo.cpp" is anyway
excluded by the preprocessor, it should not make a difference to
qmake if it is commented out (//) or not.
The -project mode is affected by the problem as well:
Actual Results - of qmake -project
Relevant part of created profile.
HEADERS += foo.h foo.cpp SOURCES += foo.cpp main.cpp
Expected Results - of qmake -project
Relevant part of created profile.
HEADERS += foo.h SOURCES += foo.cpp main.cpp
Attachments
Issue Links
- is duplicated by
-
QTBUG-62546 Reg: qmake generates incorrect makefiles when there is conditional compilation in source file
- Closed
-
QTBUG-63102 qmake generate Makefile with wrong include file dependence
- Closed
-
QTBUG-109656 A problem will cause make fail
- Closed
- relates to
-
QTBUG-24906 qmake does not add cpp files to SOURCES / OBJECTS sections in Makefile, when the same cpp file is included into another cpp file.
- Closed
-
QTBUG-97254 Pugixml workaround for QTBUG-11923 causes C1001 in MSVC2019 with PCH
- Closed
- replaces
-
QTBUG-13247 QMake silently skips source files it suspects of circular dependencies
- Closed