qmake 平台范围 [英] qmake platform scopes

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

问题描述

为 Win32、Mac 和 Linux 开发了基于标准 c++ qmake 的库.在 qmake 项目文件中,平台相关的源代码是这样包含的:

A standard c++ qmake-based library is developed for Win32, Mac, and Linux. In the qmake project file, the platform-dependent sources are included like this:

win32 {
     SOURCES += WinSystem.cpp
     HEADERS += WinSystem.h
 }

macx {
     SOURCES += MacSystem.cpp
     HEADERS += MacSystem.h
}

unix {
     SOURCES += LinuxSystem.cpp
     HEADERS += LinuxSystem.h
}

现在在 OS X 上,unixmacx 都被定义了,所以 Linux 文件也被包含在内并导致错误!有什么办法解决这个问题?

Now on OS X both unix and macx are defined, so the Linux files are also included and cause error! What is the solution to this?

推荐答案

你可以否定和合并块,所以在 unix 中而不是在 mac 中会是:

You can negate and combine blocks, so in unix but not in mac would be:

unix:!macx {
  SOURCES += LinuxSystem.cpp
  HEADERS += LinuxSystem.h
}

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

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