Qt Creator extracts the source file names from the SOURCES and HEADERS in pro and pri files by parsing the files. It understands explicitly named files, globs, and some variable expansions. If there are no files listed there, as is the case here, then there are no files in the project. With your attempt at a completely dynamic setup the only way that Qt Creator could possibly know which files qmake would ultimately include in SOURCES/HEADERS with your dynamic setup would be to 'run' the PRO file internally and intercept the end result.
The globbing and expansion functionality may help you here. This, for example, works:
TEMPLATE = app
someothersources = ../other.cpp
SOURCES += *.cpp $${someothersources}
HEADERS += *.h
TEMPLATE = app
someothersources = ../other.cpp
SOURCES += *.cpp $${someothersources}
HEADERS += *.h
To copy to clipboard, switch view to plain text mode
picking up all the CPP and H files in the directory but it will not notice new files created outside until you force it to reparse the pro file.
If I understand what you are trying to achieve:
##top.pro
TEMPLATE = app
include(headers/headers.pri)
include(sources/sources.pri)
##headers/headers.pri
HEADERS += $${PWD}/*.h
##sources/sources.pri
SOURCES += $${PWD}/*.cpp
##top.pro
TEMPLATE = app
include(headers/headers.pri)
include(sources/sources.pri)
##headers/headers.pri
HEADERS += $${PWD}/*.h
##sources/sources.pri
SOURCES += $${PWD}/*.cpp
To copy to clipboard, switch view to plain text mode
Bookmarks