[SOLVED]QMake,how to achieve kit detection and automatic conditional linking.
-
Hi,
I have a project that I am building for msvc,mingw and android ,in my project file I have something like this :#msvc #LIBS += E:\project\libs\msvc\lib0.lib #Android LIBS += E:\project\libs\android\lib.a #Mingw #LIBS += E:\project\libs\mingw\lib.a
I want to do something like:
if(using msvc kit) LIBS += E:\project\libs\msvc\lib.lib if(using android kit) LIBS += E:\project\libs\android\lib.a if(using mingw kit) LIBS += E:\project\libs\mingw\lib.a
To achieve automatic linking when I switch kits without me going back to comment and uncomment things.Is there a way I can do that in QMake?
Thank you for your time.
-
Use the mkspec name of the kit you're using to conditionally define LIBS, e.g. :
win32-msvc* { LIBS += E:\project\libs\msvc\lib.lib } android-g++ { LIBS += E:\project\libs\android\lib.a } win32-g++ { LIBS += E:\project\libs\mingw\lib.a }
The complete list of possibilities is in the
mkspecs
directory of Qt installation. -
Thanks ,works like a charm.