qmake 中的编译器范围值 [英] Compiler scope values in qmake

查看:52
本文介绍了qmake 中的编译器范围值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

qmake 提供了几个内置的平台作用域,允许一个项目文件根据当前平台执行不同的操作:

qmake provides several built-in platform scopes, allowing a project file to perform different operations depending on the current platform:

win32 {
    ...
}
unix {
    ...
}

mkspecs 目录中的所有平台规范也可用于测试各种平台/编译器组合,例如

All platform specifications in the mkspecs directory can also be used to test various platform/compiler combination, e.g.

linux-g++ {
    ...
}
win32-g++ {
    ...
}
win32-msvc2003 {
    ...
}

但是,我似乎找不到只测试编译器(没有 os)的方法

However, I can't seem to find a way to test only the compiler (without the os)

#This does not work
g++ {
    ...
}
msvc {
    ...
}

有没有办法在不必列出所有组合的情况下做到这一点(linux-g++ | win32-g++ | cygwin-g++ | ... {})?如果这是不可能的,是否有充分的理由?

Is there a way to do this without having to list all combinations (linux-g++ | win32-g++ | cygwin-g++ | ... {})? If this is not possible, is there a good reason?

推荐答案

你可以这样做:

*-g++ {
    ...
}
win32-msvc* {
    ...
}

这篇关于qmake 中的编译器范围值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆