Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select different kit in QMake from CLI

Tags:

c++

qt

qmake

When I develop in Qt Creator I can easily select my build kit from the left kit icon. However, I want to try to do the same from the command line.

In particular, I will be compiling using either Qt5 or Qt6, using the same project file (using qmake). Is there a way to tell qmake what kit to use (qt5 vs qt6)?

My qmake file doesn't currently specify a compiler/linker/debugger so I'm not sure how to tell qmake what kit to use.

like image 596
TSG Avatar asked Feb 13 '26 17:02

TSG


1 Answers

"way to tell qmake what kit to use (qt5 vs qt6)?"

Qt Creator does based on selected Qt-Kit,
choose which qmake.exe to run. Which we could do manually.

But, then Qt Creator does also based on compiler,
choose what make-spec to pass in QMake's command-line.

The result of said choices can be seen in Qt Creator's "Projects" section/ tab, which's something like:

path/to/qt-5/bin/qmake.exe path/to/my-project.pro -r -spec win32-msvc2015 "CONFIG+=declarative_debug"

Note that the "-spec win32-msvc2015" part tells QMake to load the file at:

path/to/qt-5/mkspecs/win32-msvc2015/qmake.conf

Now, the above pointed mkspecs folder contains one folder for each compiler that QMake supports, pick what works for you, and pass that in command-line (instead of win32-msvc2015).

like image 160
Top-Master Avatar answered Feb 15 '26 07:02

Top-Master



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!