Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake: Test for current spec

I would like to detect whether qmake is currently building using MingW (win32-gcc) or Visual Studio (win32-msvc200X).

At the moment I am using the following construct:

windows{
    contains(QMAKE_CC, gcc){
        # MingW
    }
    contains(QMAKE_CC, cl){
        # Visual Studio
    }
}

This does not seem particularly robust. Is there a better way?

like image 949
Rasmus Faber Avatar asked Nov 16 '09 12:11

Rasmus Faber


People also ask

What is qmake command?

qmake is a utility that automates the generation of makefiles. Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or makemake for short.

How do you use qmake?

For simple projects, you only need to run qmake in the top level directory of your project. By default, qmake generates a Makefile that you then use to build the project, and you can then run your platform's make tool to build the project. qmake can also be used to generate project files.

What is a qmake file?

The project file format used by qmake can be used to support both simple and fairly complex build systems. Simple project files use a straightforward declarative style, defining standard variables to indicate the source and header files that are used in the project.

What is PRF file QT?

prf files: In a directory listed in the QMAKEFEATURES environment variable that contains a list of directories delimited by the platform's path list separator (colon for Unix, semicolon for Windows).


1 Answers

Probably not anymore robust, but different:

windows {
    *-g++* {
        # MinGW
    }
    *-msvc* {
        # MSVC
    }
}
like image 85
Tuomas Avatar answered Oct 02 '22 17:10

Tuomas