如何生成CMakeLists.txt? [英] How to generate CMakeLists.txt?

查看:226
本文介绍了如何生成CMakeLists.txt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些有关如何自动为CMake生成CMakeLists.txt文件的指针/建议。有人知道任何现有的发电机吗?我已经检查了 CMake Wiki 中列出的内容,但很遗憾他们不适合我。

I need some pointers/advice on how to automatically generate CMakeLists.txt files for CMake. Does anyone know of any existing generators? I've checked the ones listed in the CMake Wiki but unfortunately they are not suitable for me.

我已经有一个基本的Python脚本,它可以遍历我项目的目录结构并生成所需的文件,但现在确实很笨拙。我想对它进行扩充,以考虑到例如要构建的不同平台,正在使用的编译器-交叉编译器或可能具有的库依赖关系的不同版本。我在CMake方面没有太多的专业经验,因此我可以将自己的工作作为基础,或者已经工作的生成器可能对您有很大帮助。

I already have a basic Python script which traverses my project's directory structure and generates the required files but it's really "dumb" right now. I would like to augment it to take into account for example the different platforms I'm building for, the compiler\cross-compiler I'm using or different versions of the libraries dependencies I might have. I don't have much\expert experience with CMake and an example I could base my work or an already working generator could be of great help.

推荐答案

我认为您不需要使用自动脚本来生成CMakeLists.Txt,因为在理解了基本过程之后,编写该脚本非常简单。是的,我确实同意理解CMake Wiki中给出的编写程序的过程也很困难,因为它过于详细。

I am of the opinion that you need not use an automated script for generating CMakeLists.Txt as it is a very simple task to write one, after you have understood the basic procedure. Yeah I do agree that understanding the procedure to write one as given in CMake Wiki is also difficult as it is too much detailed.

一个非常基本的示例显示了如何编写 CMakeLists.txt 显示为这里,我认为这对所有人都有用,即使是第一次写CMakeLists.txt的人。

A very basic example showing how to write CMakeLists.txt is shown here, which I think will be of use to everyone, even someone who is going to write CMakeLists.txt for the first time.

这篇关于如何生成CMakeLists.txt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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