qt - qmake 项目中的 CMake 项目

标签 qt cmake qmake

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

最佳答案

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

system(command[, mode])

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

For example:

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


正如评论中所讨论的,您的后备选项是为您的项目同时维护两者,并为您的客户提供合理的 qmake 通知期,以便他们有足够的时间进行迁移(如果他们愿意的话)。
否则,使用 system() 函数运行所需的 cmake 和 build 命令看起来至少是一种方法。

关于qt - qmake 项目中的 CMake 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20886813/

相关文章:

c++ - Qt C++ QLabel 可点击鼠标事件不起作用

c++ - QT中的多个连接对象

我可以强制 cmake 在特定目标中包含我的头文件吗?

cmake - 许可 : What is the license for LibFindMacros. cmake

c++ - 将 CWD 设置为源目录,而不是构建目录

qt - 如何限制 Qt Designer 布局的增长(大小)?

CMake:链接到具有依赖项的导入库失败

qt - qmake中如何检测当前项目是应用程序、共享库还是动态库?

c++ - qt creator 看不到 qwt header

c++ - Qt QTcpSocket 读取数据时不发出信号