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:
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
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
To copy to clipboard, switch view to plain text mode
now you create the project file:
cd foo
qmake -project . ../include
cd foo
qmake -project . ../include
To copy to clipboard, switch view to plain text mode
And the output is like this:
######################################################################
# 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
######################################################################
# 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
To copy to clipboard, switch view to plain text mode
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:
qmake -project `pwd` `pwd`/../include
qmake -project `pwd` `pwd`/../include
To copy to clipboard, switch view to plain text mode
I get, what is similar to the output of qmake 2.01a, which is part of qt 4.8
######################################################################
# 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
######################################################################
# 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
To copy to clipboard, switch view to plain text mode
But still there is no DEPENDPATH and the output of qmake 2.01a called with
cd foo
qmake -project . ../include
cd foo
qmake -project . ../include
To copy to clipboard, switch view to plain text mode
looks like this:
######################################################################
# 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
######################################################################
# 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
To copy to clipboard, switch view to plain text mode
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?
Bookmarks