PDA

View Full Version : passing variables to an mkspec definition via qmake?



akos.maroy
25th June 2009, 13:50
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:



QMAKE_CC = $$TOOLCHAIN_PREFIX-gcc
..
QMAKE_CXX = $$TOOLCHAIN_PREFIX-g++


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



qmake -set TOOLCHAIN_PREFIX i586-mingw32msvc -spec path/to/spec


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?

Teerayoot
25th June 2009, 15:04
I think you can edit qmake.conf directly.

akos.maroy
25th June 2009, 19:47
I think you can edit qmake.conf directly.

well, yes, but this is what I want to avoid..