How to add a kit to Qt Creator from the command line, or other programmatic manner?
-
In my search for a clonable install and configuration of Qt Creator, I would like to be able to programmatically install kits, which I can then reference from a
.pro.shared
file.I cannot find any reference for how to do anything like this. Is there a notion in Qt Creator for how to do this?
If not, is there a way to add it directly to the files in ~/.config/QtProject/qtcreator? It's been suggested I look at the
~/.config/QtProject/qtcreator/profiles.xml
file, but most of the information contained there is tagged with UUIDs of some kind, so I have my doubts that asystem.xml
file from one computer and O/S would work nicely on another with a different O/S. -
Hi, before I had a similar idea: when I compiled a custom Qt (e,g, static flavored) I wanted an automatic way to add my fancy new kit to an existing Qt Creator installation, and my idea was to create a new file format (*.kit files) and use a custom plugin to Qt Creator to add the kit when you double-clicked on the .kit file.
The only place I could find that programmatically adds kits to Qt Creator is the MaintenanceTool, it doesn't create .kit files but it communicates via files, that either instruct Qt Creator to remove a kit or add a new one.
I started to research how the MaintenanceTool writes those files but never got far enough.
Perhaps if you have some time, you could try to reverse engineer how MaintenanceTool does its magic kit manipulations :-) -
Thanks for the response, I think your idea is a good one. I created a feature request and mentioned your suggested
.kit
approach: https://bugreports.qt.io/projects/QTCREATORBUG/issues/QTCREATORBUG-26718?filter=allopenissuesAlas, I have neither the time nor knowledge to address this. It's primary purpose for us will be lowering the barrier to entry for new developers who would like to contribute to our open-source project. It will ultimately be more productive for us to document how to set up Qt Creator, even if it is a click-o-rama to get all the kits into place.
-
I found my post on this subject from the Qt Creator mailing list last year: https://www.mail-archive.com/qt-creator@qt-project.org/msg08218.htm where Robert asked if I could create a suggestion for it.
I was too lazy to do it, but now it's there, thanks to you :-) -
The plot thickens: https://bugreports.qt.io/browse/QTCREATORBUG-26718?focusedCommentId=601865&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-601865
sdktool
is a promising lead, now to find out how to properly format the command. -
I remember seeing sdktool in the installation log that the MaintenanceTool writes in ~/Qt. if you grep the log you'll find entries like this one:
... ... /Users/henry/Qt///Qt Creator.app/Contents/Resources/libexec/sdktool" started, arguments: "addKit --id qt.qt6.622.clang_64_kit --name Qt %{Qt:Version} for macOS --Ctoolchain x86-macos-generic-mach_o-64bit --Cxxtoolchain x86-macos-generic-mach_o-64bit --qt qt.qt6.622.clang_64 --debuggerengine 256 --devicetype Desktop ... ...
That should give some hints how to use that sdktool, also you can type
./sdktool --help addKit
or
./sdktool --help rmKit
-
Good tip to check the installation log.
It's unclear to me if the ID matters in any way. It doesn't look impossible to generate my own ID based on how the autogenerated one looks. An outstanding question I have is what purpose does the ID serve and what will happen if I get it wrong?
-
Hi re. --id:
I looked a bit more in the installation log, it seems that before every sdktool addKit... there's a sdktool addQt... command with the same --id value.
Makes sense, it follows the same logic as when you add a kit manually, i.e. first you have to add a Qt version (stating where the qmake .elf file is) and then you can a kit using that new Qt version.
So re. the --id value, I think you can use any text you want as long as you issue the sdktool addQt and sdkTool addKit commands with the same --id.