Reputation: 5335
I need to use common source files (not library!) for two projects in Qt. I've created such structure:
main
main.pro
common.pri
project1
project1.pro
project2
project2.pro
shared
(common *,cpp, *.h, etc)
Each project*.pro
contains a link to common.pri
:
include(../common.pri)
common.pri
:
(initial settings)
.........
INCLUDEPATH += ../shared/
DEPENDPATH += ../shared/
UI_SOURCES_DIR += ../shared/
So it works, but the files in the shared
directory seem to be "ownerless" and are not shown in Qt Creator. My question is, is that right, or should I add each common file into project settings?
Upvotes: 0
Views: 192
Reputation: 10067
Since those source files don't belong to a project, they won't show up in the Projects view. But if you have a common folder in that very view, which refers to the common.pri, just right-click on it and use Add existing directory ... to add the shared folder and have the stray files in the view.
I don't really know what's preventing you to put the common files in a static library, but I guess you know that would be a better practice ...
Upvotes: 2