QMake variables
-
I'm currently developing in Qt 5.5.0 w/ the MinGW version in Windows. In my .pro file, I'd like to know where the MinGW toolchain is installed (ie. C:\Qt\Qt5.5.0\Tools\mingw492_32\bin) but I can't seem to find an environment variable that points to it...
I've only been able to find these QMAKE variables:
c:\Qt\Qt5.5.0\5.5\mingw492_32\bin>qmake.exe -query QT_SYSROOT: QT_INSTALL_PREFIX:C:/Qt/Qt5.5.0/5.5/mingw492_32 QT_INSTALL_ARCHDATA:C:/Qt/Qt5.5.0/5.5/mingw492_32 QT_INSTALL_DATA:C:/Qt/Qt5.5.0/5.5/mingw492_32 QT_INSTALL_DOCS:C:/Qt/Qt5.5.0/Docs/Qt-5.5 QT_INSTALL_HEADERS:C:/Qt/Qt5.5.0/5.5/mingw492_32/include QT_INSTALL_LIBS:C:/Qt/Qt5.5.0/5.5/mingw492_32/lib QT_INSTALL_LIBEXECS:C:/Qt/Qt5.5.0/5.5/mingw492_32/bin QT_INSTALL_BINS:C:/Qt/Qt5.5.0/5.5/mingw492_32/bin QT_INSTALL_TESTS:C:/Qt/Qt5.5.0/5.5/mingw492_32/tests QT_INSTALL_PLUGINS:C:/Qt/Qt5.5.0/5.5/mingw492_32/plugins QT_INSTALL_IMPORTS:C:/Qt/Qt5.5.0/5.5/mingw492_32/imports QT_INSTALL_QML:C:/Qt/Qt5.5.0/5.5/mingw492_32/qml QT_INSTALL_TRANSLATIONS:C:/Qt/Qt5.5.0/5.5/mingw492_32/translations QT_INSTALL_CONFIGURATION: QT_INSTALL_EXAMPLES:C:/Qt/Qt5.5.0/Examples/Qt-5.5 QT_INSTALL_DEMOS:C:/Qt/Qt5.5.0/Examples/Qt-5.5 QT_HOST_PREFIX:C:/Qt/Qt5.5.0/5.5/mingw492_32 QT_HOST_DATA:C:/Qt/Qt5.5.0/5.5/mingw492_32 QT_HOST_BINS:C:/Qt/Qt5.5.0/5.5/mingw492_32/bin QT_HOST_LIBS:C:/Qt/Qt5.5.0/5.5/mingw492_32/lib QMAKE_SPEC:win32-g++ QMAKE_XSPEC:win32-g++ QMAKE_VERSION:3.0 QT_VERSION:5.5.0
Is there anywhere else I can look?
-
Hi,
There's no pre-made Qt variable for that.
Out of curiosity, why do you need that ?
-
@SGaist I'm currently using protobuf in my application and I use MSYS & Qt's MinGW toolchain to compile protobuf.
Using a .pri file similar to this: https://github.com/bitcoin/bitcoin/blob/master/share/qt/protobuf.priCompiling protobuf under MSYS places the protoc.exe compiler in C:\Qt\Qt5.5.0\Tools\mingw492_32\bin. I'd like to have a way of not hard coding the path because some team members may not be at the same Qt version.
-
If don't have a windows with MinGW at hand but check the Build panel for the PATH environment variable, this one will probably contain
C:\Qt\Qt5.5.0\Tools\mingw492_32\bin
so you don't need to set a particular path from your pro file. -
@SGaist Yea, I did see that but I use the following to test to make sure protoc.exe exists (using a hard-coded path):
win32:PROTOC_FILENAME=protoc.exe unix:PROTOC_FILENAME=protoc PROTOC = C:/Qt/Qt5.5.0/Tools/mingw492_32/bin/$$PROTOC_FILENAME exists( $$PROTOC )
I'm not certain how to go about using PATH to look for the protoc executable.
-
That's the thing, since the build environment PATH variable contains the path for MinGW, you shouldn't need the full path to protoc.exe
-
@SGaist I understand that protoc.exe will run since it's in the PATH. My problem is that I want to be able to make sure it is installed in the system first. The exists() function doesn't seem like it uses the PATH environment variable and requires and absolute full path to protoc.exe. I think my only solution is to iterate through each entry in PATH and test for protoc.exe that way.
-
You could also try with system