0

I am trying to link against libraries that are all in the same directory and use the following naming convention:

libFoo64.a           # 64-bit release
libFoo32.a           # 32-bit release
libFood64.a          # 64-bit debug
libFood32.a          # 32-bit debug

What can I put in the QMake .pro file so that the right library will be found for each build?

I am using QtCreator 4.9.0 (MSYS2 build) with the default kits enabled:

  • Desktop Qt MinGW-w64 32-bit (MSYS2)
  • Desktop Qt MinGW-w64 64-bit (MSYS2)

and for a 32-bit debug build I will choose the 32-bit kit and then the Release configuration under that, etc.

I saw this question which indicates how to set different QMake options for Debug vs. Release but I'm not sure how to extend that to also use different options depending on which Kit is in use.

M.M
  • 138,810
  • 21
  • 208
  • 365

1 Answers1

0

Based on this question I successfully achieved the goal with the following code in the .pro file:

contains(QT_ARCH, i386) {
    CONFIG(debug, debug|release) {
        message("32-bit debug")
        LIBS += -lFooBard32 -lFooBazd32 -lFooQuxd32 -lFooCorged32 -lFooGraultd32
    }else {
        message("32-bit release")
        LIBS += -lFooBar32 -lFooBaz32 -lFooQux32 -lFooCorge32 -lFooGrault32
    }
}else {
    CONFIG(debug, debug|release) {
        message("64-bit debug")
        LIBS += -lFooBard64 -lFooBazd64 -lFooQuxd64 -lFooCorged64 -lFooGraultd64
    }else {
        message("64-bit release")
        LIBS += -lFooBar64 -lFooBaz64 -lFooQux64 -lFooCorge64 -lFooGrault64
    }
}

which works although it's not particularly pretty.

I also had to modify my kit configuration so that the 32-bit compiler has 32-bit QT enabled (even though I'm doing a non-QT application , I just use QtCreator because I like the IDE, and I didn't previously have 32-bit QT even installed). The QT_ARCH variable seems to be based on the "Qt Version" configured in the kit, not the actual compiler selected in the kit.

M.M
  • 138,810
  • 21
  • 208
  • 365