Main
Main

Reputation: 1842

How to load 32/64 bit library changing the compiler kit in Qt Creator?

How can I load different compiler kit depending on the 32/64 bit compiler chosen when changing the kit. I tried like this. But this always loads x64 library. I have MSVC2017-x64 and MSVC2015-x32 bit compilers.

win32:contains(QMAKE_HOST.arch, x86_64) {
  LIBS += -L"$$PWD/lib/x64" -lftd2xx

} else {
  LIBS += -L"$$PWD/lib/x86" -lftd2xx
}

Upvotes: 0

Views: 208

Answers (1)

dydil
dydil

Reputation: 1007

Here is what I am doing in my project. If I use MSVC 2017 64 bits it links to myLib_64. Otherwise it links to myLib_32. You can adapt it for your situation.

MAKE_SPEC = $$split(QMAKESPEC, /)
contains(MAKE_SPEC, msvc2017_64):{
    LIB_SUFFIX = _64
} else {
    LIB_SUFFIX = _32
}

LIBS += -lMyLib$$LIB_SUFFIX

Upvotes: 1

Related Questions