Search code examples
qtbuildcmdqmakenmake

qmake build from command prompt


I need to have a cmd build script to address x86 x64 compilation issue associated with the IDE (i mean switching qt versions & rebuilding). The problem is that, in my .pro file, I add dependency on external library in this way:

LIBS += ../Libs/SomeExternal.lib

Now when I build this project from QtCreator, everything compiles and builds fine, but when I try to build using command prompt + qmake I get the following linker error:

LINK : fatal error LNK1104: cannot open file '../Libs/SomeExternal.lib'

I understand that this issue is related to paths, but I don't know how to let LINKER.exe see the location where my project is located. Just like QtCreator does.

I try to build using the following way:

  • I run VS command prompt. I'm using MSVC compiler.
  • I type qmake.exe -project C:\ProjectPath\Project.pro
  • nmake

Thanks


Solution

  • Use:

    LIBS += -L$${PWD}/../Libs -lSomeExternal
    

    From the documentation:

    The PWD variable specifies the full path leading to the directory containing the current file being parsed.