I found a solution with QMAKESPEC

message("SPEC " $$QMAKESPEC) message("SPEC " $$basename(QMAKESPEC))

The output is for instance:

Project MESSAGE: QMAKESPEC C:/Qt/5.4/mingw491_32/mkspecs/win32-g++ Project MESSAGE: SPEC win32-g++

or on linux

Project MESSAGE: QMAKESPEC /home/bloblo/Qt/5.9.1/gcc_64/mkspecs/linux-g++ Project MESSAGE: SPEC linux-g++