如何从的CMakeLists.txt cscope.files [英] How to generate cscope.files from CMakeLists.txt

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

问题描述

我使用的CMake建立我的code。的CMakeLists.txt包含了所有的.C或.cpp文件列表和所有的include目录。

I'm using CMake to build my code. CMakeLists.txt contains the list of all the .C or .CPP files and all the include directories.

如何能实现的CMakeLists.txt,这样我可以有一个生成包含所有.C和.cpp名单对我来说cscope.files一个制作选项(或.CXX),它从包括目录中的文件和所有的.h文件?

How can I implement CMakeLists.txt so that I can have a make option that generates cscope.files for me containing the list of all the .C and .CPP (or .CXX) files and also all the .h files from the include directories in it?

有关如我应该能够运行使cscopefiles ,它会产生cscope.files我。

For e.g. I should be able to run make cscopefiles and it will generate cscope.files for me.

还是有已经这样的选择?

Or is there already such an option?

推荐答案

您也可以用电话configure_file延长弗雷泽的答案,所以最终的文件只能更改时,其内容已被更改。

You could also extend Fraser's answer with a configure_file call, so the final file only changes when its content has changed.

file(WRITE
  ${CMAKE_BINARY_DIR}/cscope.files.in
  "${AllFiles}")
configure_file(
  ${CMAKE_BINARY_DIR}/cscope.files.in
  ${CMAKE_BINARY_DIR}/cscope.files
  COPYONLY)

这可能有助于减少增量的重建,如果别的东西(自定义命令),取决于cscope.files输出文件。如果结果是从目前的内容不同的configure_file通话将只更新输出文件。

That could help minimize incremental rebuilds if something else (a custom command) depends on the cscope.files output file. The configure_file call will only update the output file if the result is different from its current contents.

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

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