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:

Qt Code:
  1. mkdir foo include
  2. touch foo/main.cpp foo/other.cpp foo/other.h
  3. touch include/sample.h
  4. echo "#include sample.h" > foo/other.cpp
  5. echo "#include other.h" >foo/main.cpp
To copy to clipboard, switch view to plain text mode 

now you create the project file:

Qt Code:
  1. cd foo
  2. qmake -project . ../include
To copy to clipboard, switch view to plain text mode 

And the output is like this:

Qt Code:
  1. ######################################################################
  2. # Automatically generated by qmake (3.0) Wed Mar 1 09:07:42 2017
  3. ######################################################################
  4.  
  5. TEMPLATE = app
  6. TARGET = foo
  7. INCLUDEPATH += .
  8.  
  9. # Input
  10. HEADERS += other.h /other.h /../include/sample.h
  11. 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:

Qt Code:
  1. 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

Qt Code:
  1. ######################################################################
  2. # Automatically generated by qmake (3.0) Wed Mar 1 09:13:38 2017
  3. ######################################################################
  4.  
  5. TEMPLATE = app
  6. TARGET = foo
  7. INCLUDEPATH += .
  8.  
  9. # Input
  10. HEADERS += other.h ../include/sample.h
  11. 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

Qt Code:
  1. cd foo
  2. qmake -project . ../include
To copy to clipboard, switch view to plain text mode 

looks like this:

Qt Code:
  1. ######################################################################
  2. # Automatically generated by qmake (2.01a) Wed Mar 1 09:23:53 2017
  3. ######################################################################
  4.  
  5. TEMPLATE = app
  6. TARGET =
  7. DEPENDPATH += . . ../include
  8. INCLUDEPATH += .
  9.  
  10. # Input
  11. HEADERS += other.h ../include/sample.h
  12. 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?