长话短说,我们有一个 Qt 项目,我正在考虑迁移到 CMake。但是,我们的一些客户将现有库用作 Qt subdirs 项目中的子项目。这是否意味着我们在构建系统上坚持使用 Qt?
最佳答案
这是可能的,但很丑陋。例如,您可以在 qmake 文件中使用 system() 函数:
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/