• qmake 参数


    E:\workspace\QtWork\qmake\option.cpp:Option::init()
    -project  设置qmake生成工程相关文件,如果用qt creator开发的话这个命令参数基本用不到。
    -prl 设置qmake生成prl文件。
    -set 设置自定义属性,会存放到注册表中。具体参考属性
    -unset  取消自定义属性
    -query 查询自定义属性
    -makefile  默认模式。设置qmake通过输入的.pro文件生成makefile

    E:\workspace\QtWork\qmake\library\qmakeglobals.cpp:QMakeGlobals::addCommandLineArguments()
    -- extraargs 设置内置变量QMAKE_EXTRA_ARGS的值,该内置变量默认是空,时态为before,必须设置为最后一个参数

    下面的state,设置命令行参数的解析时机,默认为before,每一个state可以设置command和-config参数。command 必须含有"="符号,为了避免被误解析,需要用双引号将command引用起来,使用参考本文下面的案例。如果要在工程的pro文件中输出命令行输入的命令的变量值,需要使用-early或-before。具体原因参考:qmake与配置文件
    -early
    -before
    -after
    -late

    -config  添加配置属性
    -nocache  
    -cache 
    -qtconf  设置qt.conf qt读取conf文件


    -platform/-spec 设置主机架构
    -xplatform/-xspec 设置目标机架构
    参数中没有设置会进入环境变量中查找QMAKESPEC和XQMAKESPEC变量,环境变量中没找到会到属性中查找QMAKE_SPEC和QMAKE_XSPEC变量。
    ​​​​​​​如果缓存文件.qmake.conf .qmake.cache .qmake.stash中存在QMAKESPEC和XQMAEKSPEC,会使用缓存文件中的值。host_build指定创建QMAKE_SPEC的配置的工程 还是QMAKE_XSPEC的配置的工程,默认为false,指定后者。


    -template/-t  ,设置模板,默认为app,等价于pro文件中的TEMPLATE变量,模板有以下选项

    -template_prefix/-tp  为template 设置前缀。

    -win32  设置路径间隔符号为 (dir_sep = QLatin1Char('\\');)
    -unix    设置路径间隔符号为(dir_sep = QLatin1Char('/');)

    E:\workspace\QtWork\qmake\option.cpp:Option::parseCommandLine()
    -d debug-level   设置日志等级 -d表示1级  -d -d表示2级
    -v/-version/--version  qmake版本
    -h/-help/--help 

    warn-level  设置警告类型
    -Wall
    -Wparser
    -Wlogic
    -Wdeprecated
    -Wnone

    -r/-recursive
    -nr/-norecursive
    -o/-output  指定输出的文件名,如果指定为"-"表示输出到 stdout 。

    Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||Option::qmake_mode == Option::QMAKE_GENERATE_PRL
    -nodepend/-nodepends
    -nomoc
    -createstub
    -nodependheuristics
    -E  (do_preprocess)
    project_files.append(filepath);

    Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT
    -nopwd
    project_dirs.append(dirpath);

    案例:

    qmake -set myproperty ok  //设置属性

    -config与state结合使用,默认state是before(需要注意,qmake无法识别参数中的tab键,会将tab键当做一个字符,这是一个qmake的小小的bug):

    E:/test/t1.pro -o E:/test/ -spec win32-msvc -config dddd "var1=1111" "CONFIG+=debug"  "CONFIG+=qml_debug" -d   -early -config aaaa "var2=2222" -after -config bbbb "var3=3333" -late -config cccc "var3=4444"  -- VVV1

    该命令对应的组装出来的代码:

    组装出来的不同state的command
    对应断点堆栈
    1. //E:\workspace\QtWork\qmake\library\qmakeglobals.cpp
    2. void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
    3. {
    4. if (!state.extraargs.isEmpty()) {
    5. QString extra = fL1S("QMAKE_EXTRA_ARGS =");
    6. for (const QString &ea : qAsConst(state.extraargs))
    7. extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
    8. state.cmds[QMakeEvalBefore] << extra;
    9. }
    10. for (int p = 0; p < 4; p++) {
    11. if (!state.configs[p].isEmpty())
    12. state.cmds[p] << (fL1S("CONFIG += ") + state.configs[p].join(QLatin1Char(' ')));
    13. extra_cmds[p] = state.cmds[p].join(QLatin1Char('\n'));
    14. }
    15. if (xqmakespec.isEmpty())
    16. xqmakespec = qmakespec;
    17. }

  • 相关阅读:
    jwt的了解和使用以及大致代码分析
    mysql数据库什么时候才需要分库分表
    docker入门加实战—部署Java和前端项目
    【元胞自动机】基于matlab元胞自动机考虑驾驶行为的自动—求解手动驾驶混合交通流问题【含Matlab源码 2060期】
    tcp客户端向tcp服务器发送json文件,服务器转存为json文件
    android 性能优化之内存泄漏分析工具-Mat使用
    C专家编程 第3章 分析C语言的声明 3.1 只有编译器才会喜欢的语法
    Jenkins实现CI/CD发布(Ansible/jenkins共享库/gitlab)
    Python Lambda 常用使用方法汇总(结合fliter\map\reduce等函数)
    漏洞复现-.Net-ueditor上传
  • 原文地址:https://blog.csdn.net/qiushangren/article/details/127987229