以文本方式查看主题 - 曙海教育集团论坛 (http://peixun0.cn/bbs/index.asp) -- Linux技术讨论区 (http://peixun0.cn/bbs/list.asp?boardid=7) ---- qmake命令参考 (http://peixun0.cn/bbs/dispbbs.asp?boardid=7&id=14) |
-- 作者:yarson6 -- 发布时间:2009-3-10 21:34:20 -- qmake命令参考 qmake Command Reference Command Line Options System Variables Functions Environment Variables and Configuration About This Reference In addition to the variables and functions described in the following sections, qmake project files may also include comments. Comments begin with the \'#\' symbol and run to the end of the line. Command Line Options Options -o file -unix -macx -win32 -d -t tmpl -help There are also warning options that can help to find problems in your project file: -Wall -Wnone -Wparser -Wlogic qmake supports two different modes of operation. The first mode, which is the default is makefile generation. In this mode, qmake will take a .pro file and turn it into a makefile. Creating makefiles is covered by this reference guide, there is another mode which generates .pro files. To toggle between these modes you must specify in the first argument what mode you want to use. If no mode is specified, qmake will assume you want makefile mode. The available modes are: -makefile -project Makefile Mode -after -nocache -nodepend -cache file -spec spec The files argument can be a list of one or more project files, separated by spaces. You may also pass qmake assignments on the command line here and they will be processed before all files specified, for example: qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro If however you are certain you want your variables processed after the the files specified, then you may pass the -after argument. When this is specified all assignments on the commandline after the -after option will be postponed until after the specified files are parsed. This will generate a Makefile, from test.pro with Unix pathnames. However many of these arguments aren\'t necessary as they are the default. Therefore the line can be simplified on Unix to: qmake "CONFIG+=test" test.pro Projectfile Mode -r -nopwd The files argument can be a list of files or directories. If a directory is specified, then it will be included in the DEPENDPATH variable and relevant code from there will be included in the generated project file, if a file is given it will go into the correct variable depending on extension (i.e. .ui files go into FORMS, .cpp files go into SOURCES, etc). Here too you may pass assignments on the commandline, when doing so these assignments will be placed last in the generated .pro file. System Variables Rarely Used System Variables Frequently Used System Variables CONFIG These CONFIG values control compilation flags: release - Compile with optimization enabled, ignored if "debug" is specified debug - Compile with debug options enabled warn_on - The compiler should emit more warnings than normally, ignored if "warn_off" is specified warn_off - The compiler should only emit severe warnings. These options define the application/library type: qt - The target is a Qt application/library and requires the Qt header files/library. The proper include and library paths for the Qt library will automatically be added to the project. opengl - The target requires the OpenGL (or Mesa) headers/libraries. The proper include and library paths for these libraries will automatically be added to the project. thread - The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project. x11 - The target is a X11 application or library. The proper include paths and libraries will automatically be added to the project. windows - The target is a Win32 window application (app only). The proper include paths,compiler flags and libraries will automatically be added to the project. console - The target is a Win32 console application (app only). The proper include paths, compiler flags and libraries will automatically be added to the project. dll - The target is a shared object/DLL.The proper include paths, compiler flags and libraries will automatically be added to the project. staticlib - The target is a static library (lib only). The proper compiler flags will automatically be added to the project. plugin - The target is a plugin (lib only). This enables dll as well. The CONFIG variable will also be checked when resolving scopes. You may assign anything to this variable. For example: CONFIG += qt console newstuff DEFINES For example: DEF_FILE Specifies a .def file to be included in the project. DESTDIR For example: DLLDESTDIR HEADERS qmake will generate dependency information (unless -nodepend is specified on the command line) for the specified headers. qmake will also automatically detect if moc is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the moc files. For example: HEADERS = myclass.h \\ See also SOURCES. INCLUDEPATH For example: INCLUDEPATH = c:\\msdev\\include d:\\stl\\include FORMS For example: FORMS = mydialog.ui \\
|