I have an exe that depends on multiple static libs and in visual studio, they are all managed as part of 1 sln file and the exe has dependencies on the static libs.
How can this be set up in Qt Creator? Seems like there are 2 options: 1. create multiple projects in a Qt Creator "session". But a session is not shared among users, right? so i'm not sure how that would work? For example, is there a session file that gets created? 2. use subprojects. and make the static lib sub projs of the exe?
Any recommendations? I'm totally new to Qt Creator and need to use it for a linux port.
Thanks!
To get qmake
to produce a nice .sln
with subprojects, make one main .pro
file with the subdirs
template, and set the necessary dependencies of each project on another.
QtCreator uses qmake
behind the scenes to generate a makefile and build from that, but you can also produce VS solution files by running
qmake ../path/to/source -tp vc
You can also use the Qt Visual Studio add-in to GUI-ify the process.
Also: to make sure the executable is relinked each time a dependant static lib is changed, use
CONFIG( debug, debug|release ) {
LIBSUFFIX = d
win32:LIBS += -L../staticlib1/debug
win32:PRE_TARGETDEPS += ../staticlib1/debug/libAmbrosiad.a
} else {
LIBSUFFIX =
win32:LIBS += -L../staticlib1/release
win32:PRE_TARGETDEPS += ../staticlib1/release/libAmbrosia.a
}
unix:LIBS += -L ../libAmbrosia
unix:PRE_TARGETDEPS += ../libAmbrosia/libAmbrosia$${LIBSUFFIX}.a
Place something like this in your executable's .pro
file, with the note that the LIBSUFFIX part is completely optional, but in line with how Qt itself is built, so that's what I use too. Mind the "release" and "debug" subdirectories absent on Linux/Mac builds. And to be complete: the rather verbose if-else
condition is The Right Way (TM)
to differentiate debug
from release
builds in qmake project files. Simpler ways may break under several circumstances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With