I wonder if it's possible to pass a variable to an mkspec definition, at the invocation of qmake? I'm thinking of passing a variable, that would be used as a substitution value (e.g. $$VAR_NAME) in the mkspec qmake.conf file.

what I'm trying to solve in particular, is a cross-compilation setup, where I'm cross-compiling a project on Linux, for Windows, using MinGW. it works all fine, but depending on how you set up your cross-compliation toolchain, the names of the executables in the toolchain have different prefixes, like i586-mingw32msvc-gcc, or mingw32-gcc, etc. otherwise, the whole spec file is the same, it's only that the prefixes for these commands should be different.

I was trying to solve this issue using the following thinking in the spec's qmake.conf:

Qt Code:
  1. QMAKE_CC = $$TOOLCHAIN_PREFIX-gcc
  2. ..
  3. QMAKE_CXX = $$TOOLCHAIN_PREFIX-g++
To copy to clipboard, switch view to plain text mode 

where one would set a variable, TOOLCHAIN_PREFIX at the invocation of qmake, e.g. something like:

Qt Code:
  1. qmake -set TOOLCHAIN_PREFIX i586-mingw32msvc -spec path/to/spec
To copy to clipboard, switch view to plain text mode 

but it doesn't seem to work is there a way to do this, other than creating a separate spec for each of the different toolchain names?