qmake平台范围 [英] qmake platform scopes

查看:78
本文介绍了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天全站免登陆