- 
    
Bug
 - 
    Resolution: Done
 - 
    
P2: Important
 - 
    5.12.3
 - 
    None
 - 
    Arch Linux
QMake version 3.1
Using Qt version 5.12.3 in /usr/lib
GNU Make 4.2.1
g++ (GCC) 8.3.0 
- 
        57f38bc49d43140f3b04e625a47eb1e6de8d2ae3 (qt/qtbase/dev)
 
The situation:
mylib/ # This dir should be irrelevant, but isn't!
mylib.cpp # This file is added to the build!
myapp/
myapp.pro
mylib/
mylib.pri
mylib.cpp
bar.cpp
build/ # Doing my builds in here
From myapp.pro, I'm including mylib.pri:
include(mylib/mylib.pri)
From mylib.pri, I'm adding mylib's sources to the build:
SOURCES += $$PWD/mylib.cpp $$PWD/bar.cpp
Then I'm running qmake, inside myapp/build:
rm -rf build && mkdir build && (cd build && qmake ..)
Inspecting the generated Makefile reveals:
  SOURCES = ../../mylib/mylib.cpp
             ../mylib/bar.cpp
             ../myapp.cpp
That's one ../ too many for mylib.cpp! But bar.cpp, which exists only in myapp/mylib/ but not in the top-level copy of mylib/, is resolved correctly.
Clues:
- message($$SOURCES) shows the correct absolute paths, so somehow these are turned into incorrect relative paths at some later stage.
 - If I just put the SOURCES of mylib directly into myapp.pro rather than using include(), the problem goes away.
 - If I rename the top-level mylib to something else, the problem goes away.
 - If I put the build/ directory as a sibling to myapp/, the problem goes away.
 - If I put the build/ directory as a sub-sub-directory like myapp/build/build, the problem goes away.