alexandernst
alexandernst

Reputation: 15099

Forcing specific version of QT in .pro file

I'm searching for a way to force a specific version of QT in a .pro file. To be more specific, I'd like to force qmake to use only QT 5.x version with my project instead of QT 4.x and QT 5.x

Is there a way to do so?

PS: I'm not asking for a way to stop/halt the compile process (aka check QT version, and if lower than 5.x just throw qFatal/equivalent). I'm looking for a way to actually choose which version to use while generating the Makefile with qmake

Upvotes: 4

Views: 6013

Answers (3)

Ashish
Ashish

Reputation: 620

You can throw a error if a user is running qmake with a version you do not want him to use. ex:

lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5")

Upvotes: 7

Pierluigi
Pierluigi

Reputation: 2294

As Amartel wrote in his answer, you should point to the correct qmake version (check it by typing qmake --version in the console)

It might be that your project has been generated using the wrong qmake executable and some files are not removed even if you issue a nmake clean or make clean.

Check that there are no Makefile in the source tree after the clean (these files will typically contain the path to the qt version to use, and if not regenerated correctly will point to the wrong Qt version).

Upvotes: 1

Amartel
Amartel

Reputation: 4286

I really doubt you can do this. qmake is a part of framework and goes together with libraries. When you say Qt of specific verion you mean only libraries, but it is not correct.

To use specific version of Qt, you actially need to run different version of qmake. If you are using QtCreator - you should select it in project's options, if not - type absolute path to file qmake. You can find out, which version of Qt qmake uses, you can type qmake --version.

Upvotes: 4

Related Questions