[Interest] qmake project file questions

Koehne Kai Kai.Koehne at digia.com
Fri Feb 14 15:38:48 CET 2014


> -----Original Message-----
> From: interest-bounces+kai.koehne=digia.com at qt-project.org
> files =\
>    foo.cpp \
>    foo.h \
>    bar.cpp \
>    bar.h
> 
> for(file, files) {
>    contains(file, '.*.h') {
>       message(header = $$file)
>       HEADERS *= $$file
>    }
>    contains(file, '.*.cpp') {
>       message(source = $$file)
>       SOURCES *= $$file
>    }
> }
> 
> [...]
> However, the problem is that all the files are added to both HEADERS and
> SOURCES. It appears that the HEADERS and SOURCES assignments simply
> ignore the contains()-check, even though they are placed inside the scopes
> of these checks?

I guess you mean that headers/sources appear twice within Qt Creator project tree, both under 'Headers' and 'Sources'?

The reason is that Qt Creator takes the liberty to ignore scopes when parsing the project file. This is to ensure that it shows all sources, even one's that e.g. are not applicable on the current platform ... when you're e.g. refactoring you want to see references in Mac files too, even when you're under Windows. That's different from what qmake will do.

Regards

Kai



More information about the Interest mailing list