qmake.conf文件是qt用于存放系统平台和编译器相关默认值的配置文件。qt为所支持的各种系统平台和对应编译器附加了相关的配置文件。其位置在QtInstallDIr/Qt5.12.0\5.12.0\msvc2015_64\mkspecs中。
这里的每一个文件夹代表一个qt所支持的目标系统平台+编译器组合,比如windows台式机+msvc的目标系统相关的默认配置所在路径为win32_msvc。windows uwpx64+msvc2015的目标系统的配置路径为winrt-x64-msvc2015。
下面是win32-g++/qmake.conf的内容:
#
# qmake configuration for win32-g++
#
# Written for MinGW-w64 / gcc 5.3 or higher
#
# Cross compile example for i686-w64-mingw32-g++:
# configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-
#include(../common/g++-win32.conf)# modifications to g++-win32.confQMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_CFLAGS += -fno-keep-inline-dllexport
QMAKE_CFLAGS_WARN_ON += -WextraQMAKE_CXX = $${CROSS_COMPILE}g++
QMAKE_CXXFLAGS += -fno-keep-inline-dllexport
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ONQMAKE_LINK = $${CROSS_COMPILE}g++
QMAKE_LINK_C = $${CROSS_COMPILE}gccload(qt_config)
其中QMAKE_CC等等都是qmake中的内置变量,可以看到qmake.conf体系文件的作用包括对qmake的内置变量初始化。
qmake requires a platform and compiler description file which contains many default values used to generate appropriate Makefiles. The standard Qt distribution comes with many of these files, located in the mkspecs subdirectory of the Qt installation.
The QMAKESPEC environment variable can contain any of the following:
- A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
- The name of a platform-compiler combination. In this case, qmake will search in the directory specified by the mkspecs subdirectory of the data path specified when Qt was compiled (see QLibraryInfo::DataPath).
Note: The QMAKESPEC path will be automatically added to the generated Makefile after the contents of the INCLUDEPATH system variable.
qmake命令行参数 - 百度文库