[Interest] qmake project file questions

Thomas Sevaldrud thomas at silentwings.no
Thu Feb 13 23:10:22 CET 2014


Hi, I have a question about scope tests in .pro files. The following .pro
file behaves a bit differently than I expected:

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

   }

}


When I run this in Qt Creator I see the messages as I would expect:

Project MESSAGE: source = foo.cpp

Project MESSAGE: header = foo.h

etc...


It runs through everything twice, but that's becuause it generates both
debug and realease I guess.


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?


What am I doing wrong here?


- Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140213/07edd625/attachment.html>


More information about the Interest mailing list