I like to include Qt project files to another Qt project. Long story short I've a production project and a test project. They're separate from each other to keep the production code clean.
I've tried add the headers and the sources with wildcard but it's not recursive.
SOURCES += path\to\production\*.cpp
After that I wrote a qmake logic to filter files.
QT += core
QT -= gui
TARGET = qt_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES = main.cpp
message("Fetching production code")
win32:PRODUCION_FILES = $$system(dir path\to\production /s /b)
for(a, PRODUCION_FILES) {
IS_HEADER = $$find( a, .h$ )
count( IS_HEADER, 1 ) {
HEADERS += $$a
}
IS_CPP = $$find( a, .cpp$ )
count( IS_CPP, 1 ) {
SOURCES += $${a}
}
IS_FORM = $$find( a, .ui$ )
count( IS_FORM, 1 ) {
FORMS += $${a}
}
}
message("Production code fetched!")
message(Headers: $$HEADERS)
message(Sources: $$SOURCES)
message(Forms: $$FORMS)
When the .pro file compiled the messages look fine:
Project MESSAGE: Fetching production code
Project MESSAGE: Production code fetched!
Project MESSAGE: Headers: path\to\production\mainwindow.h
Project MESSAGE: Sources: main.cpp path\to\production\main.cpp path\to\production\mainwindow.cpp
Project MESSAGE: Forms: path\to\production\mainwindow.ui
But somehow when I look at the Projects tab in the QtCreator I see all kinds of files for example in the Headers section (like cpp and ui and even pro).
What am I missing?
I use Qt 5.4.1 compiled with mingw4.9.2 64bit on a Win7 system in QtCreator 3.5.
I appreciate your suggestions and help.
Thanks, spiralfuzet