0

In QtCreator, if you want to modify the Build Directory, in Projects/Build Setttings/General, you can set a fixed path, like /var/tmp/some-dir, or you can use the A->B button to use QtCreator internal variables.

I am trying to get the value of the platform (win, mac, unix...), and architecture (x86, x64, arm...) defined in the current Kit from these internal variables, and use them to set the path to Build Directory.

I searched a lot, asked a lot, and so far, nothing.

So, I am asking here: does anyone know from which QtCreator internal variables, like %Compiler:Name, can I get the platform and architecture?

I suspect %CurrentRun:Env:<value> or less likely $Compile:Name:<value>, could be the one, but I could not find the possible values for the <value> parameter anywhere.

canellas
  • 491
  • 5
  • 17
  • Does `Debugger:ABI` help? Or how about `Qt:mkspec`? – JarMan Feb 12 '21 at 16:33
  • @JarMan, I was thinking of somehow using `%JS` to split `Debugger:ABI`, but mine evaluates to `x86-darwin-generic-mach_o-64bit arm-darwin-generic-mach_o-64bit`, which seems all the ABIs my compiler complies to, so I would not know which is being used in the currently Kit. `Qt:Mkspec`, `Qt:QMAKE_SPEC` or `Qt:QMAKE_XSPEC` evaluates to `macx-clang`. I could (no idea how) split it, but I am not sure this format (platform-compiler) would be the same used for others `Qt:Mkspec` values. Furthermore, architecture would still be missing. – canellas Feb 12 '21 at 17:07
  • There probably is not something perfect for your needs. One possibility is to name your kits in a way that is easy for you to parse in a consistent way. – JarMan Feb 12 '21 at 17:11
  • I wonder if besides `%Kit:Id` and `%Kit:Name`, there are more Kit related variables, with all the data set for a Kit, but, again, I could not find it. Thanks for your time! – canellas Feb 12 '21 at 17:20

1 Answers1

0

I see you're familiar with A->B. There you can search the variables by name.

In your case you could use Env: to read an environmental variable.

  • Windows: %PROCESSOR_ARCHITECTURE%
  • Linux: $HOSTTYPE or $MACHTYPE
  • Mac: I'm not familiar with Apple environment, but you can find out by running printenv

Or you could declare a new one in your systems and across the different platforms

To access the list of variables available: https://stackoverflow.com/a/66025506/10996546

Jack Lilhammers
  • 1,207
  • 7
  • 19
  • 1
    Those will provide the host architectures, but not necessarily the target architecture of any given kit. – JarMan Feb 12 '21 at 17:21