I want to organize my project in the following order:
projectname\
projectname.pro
common.pri
projectname\gui\
gui.pro
mainwindow.cpp
mainwindow.h
mainwindow.ui
projectname\aname\
aname.pro
h and cpp files only
projectname\test\
test.pro
main.cpp
projectname.pro:
TEMPLATE = subdirs
SUBDIRS = gui \
aname
QT += core gui
# main app
CONFIG += ordered
SUBDIRS += test
TEMPLATE = subdirs
SUBDIRS = gui \
aname
QT += core gui
# main app
CONFIG += ordered
SUBDIRS += test
To copy to clipboard, switch view to plain text mode
common.pri:
INCLUDEPATH += gui \
aname
WARNINGS += -Wall
# The following keeps the generated files at least somewhat separate
# from the source files.
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
INCLUDEPATH += gui \
aname
WARNINGS += -Wall
# The following keeps the generated files at least somewhat separate
# from the source files.
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
To copy to clipboard, switch view to plain text mode
gui.pro:
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
FORMS += \
mainwindow.ui
SOURCES += \
mainwindow.cpp
HEADERS += \
mainwindow.h \
OBJECTS_DIR += projectname\gui\mainwindow.h
QMAKE_EXT_OBJ += projectname\gui\mainwindow.h
LIBS += -L../aname -laname
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
FORMS += \
mainwindow.ui
SOURCES += \
mainwindow.cpp
HEADERS += \
mainwindow.h \
OBJECTS_DIR += projectname\gui\mainwindow.h
QMAKE_EXT_OBJ += projectname\gui\mainwindow.h
LIBS += -L../aname -laname
To copy to clipboard, switch view to plain text mode
aname.pro:
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
SOURCES += \
...cpp
HEADERS += \
....h
OBJECTS_DIR += projectname/aname/....h \
QMAKE_EXT_OBJ = projectname/aname/....h \
test.pro
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
TARGET = test
TEMPLATE = app
SOURCES += \
main.cpp \
LIBS += -L../gui -lgui
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
SOURCES += \
...cpp
HEADERS += \
....h
OBJECTS_DIR += projectname/aname/....h \
QMAKE_EXT_OBJ = projectname/aname/....h \
test.pro
! include( ../common.pri ) {
error( Couldn't find the common.pri file! )
}
QT += core gui
TARGET = test
TEMPLATE = app
SOURCES += \
main.cpp \
LIBS += -L../gui -lgui
To copy to clipboard, switch view to plain text mode
I want my header and source located in the same folder, but I want the #include to be <projectname/amame/...h>. I have tried the OBJECTS_DIR and QMAKE_EXT_OBJ but it don't seem to find the header files. It can't find the header in #include <...h> current folder ether. The qtcreator auto completion seems to be a bit smarter since it finds the headers... hehe.
Can anyone see what I'm doing wrong and how I can get the #include <projectname/aname/..>
Bookmarks