`qmake -project` weired output (QT 5)
I'm using qmake -project to generate the *.pro files by a script on Linux. Worked fine the last 7 years up to qt 4.8. But now I did upgrade to qt 5.7 and the output of qmake -project is pretty nonsense.
Could be simply verfied by doing this:
Code:
mkdir foo include
touch foo/main.cpp foo/other.cpp foo/other.h
touch include/sample.h
echo "#include sample.h" > foo/other.cpp
echo "#include other.h" >foo/main.cpp
now you create the project file:
Code:
cd foo
qmake -project . ../include
And the output is like this:
Code:
######################################################################
# Automatically generated by qmake (3.0) Wed Mar 1 09:07:42 2017
######################################################################
TEMPLATE = app
TARGET = foo
INCLUDEPATH += .
# Input
HEADERS += other.h /other.h /../include/sample.h
SOURCES += main.cpp other.cpp /main.cpp /other.cpp
So there are source file twice and at one time there is that slash in front of the path.
If I try something like this:
Code:
qmake -project `pwd` `pwd`/../include
I get, what is similar to the output of qmake 2.01a, which is part of qt 4.8
Code:
######################################################################
# Automatically generated by qmake (3.0) Wed Mar 1 09:13:38 2017
######################################################################
TEMPLATE = app
TARGET = foo
INCLUDEPATH += .
# Input
HEADERS += other.h ../include/sample.h
SOURCES += main.cpp other.cpp
But still there is no DEPENDPATH and the output of qmake 2.01a called with
Code:
cd foo
qmake -project . ../include
looks like this:
Code:
######################################################################
# Automatically generated by qmake (2.01a) Wed Mar 1 09:23:53 2017
######################################################################
TEMPLATE = app
TARGET =
DEPENDPATH += . . ../include
INCLUDEPATH += .
# Input
HEADERS += other.h ../include/sample.h
SOURCES += main.cpp other.cpp
So my workaround is to create the project files with qmake 2.01a, because even if I do that weired stuff with `pwd`, I get no satisfying output, as sometimes qmake does not remove that absolute path and so the pro file will just work in my work environment only and the other people here are not supposed to generate pro files, every time I add a new file to our software.
Is the current version of qmake broken or do I miss something?
Re: `qmake -project` weired output (QT 5)
I can confirm this, looks like a bug.
Any specific reason you are using that at all?
You write "our software" so it sounds like this is not some simple quick test you are running this on but a real application or library which should have a project file already, no?
Cheers,
_