CMake项目里面一个qmake项目 [英] CMake project inside a qmake project

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

问题描述

长话短说,我们有一个Qt项目,我正在考虑迁移到CMake。但是,我们的一些客户使用现有库作为Qt subdirs项目中的子项目。这是否意味着我们被建立系统的Qt?

Long story short, we have a Qt project that I'm thinking of migrating to CMake. However, some of our customers use the existing library as a subproject in a Qt subdirs project. Does that mean we are stuck with Qt for the build system?

推荐答案

这是可能的,但是丑陋。例如,您可以在qmake文件中使用system()函数:

This is possible, but ugly. You could for instance use the system() function in a qmake file:


system(command [,mode])

您可以使用此系统函数的变体从命令获取stdout并将其分配给一个变量。

You can use this variant of the system function to obtain stdout from the command and assign it to a variable.

例如:

UNAME = $$ system(uname -s)
包含(UNAME,[lL] inux):message(这看起来像是Linux($$ UNAME) p>

UNAME = $$system(uname -s) contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

正如评论中所讨论的,您的备用选项将是为您的项目维护两者,并为您的客户提供合理的通知期如果他们愿意,他们有足够的时间迁移。

As discussed in the comment, your fallback option would be to maintain both for your project, and give your customer a reasonable amount of notice period for qmake so that they have enough time for the migration if they are willing to.

否则,使用system()函数运行所需的cmake和build命令看起来至少一,去的路。

Otherwise, running the desired cmake and build commands with the system() function looks, at least one, way to go.

这篇关于CMake项目里面一个qmake项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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