内容简介:http://stackoverflow.com/questions/10914607/how-to-collect-source-files-with-cmake-without-globbing
CMake documentation 明确声明文件(GLOB …)不是
建议收集源文件进行构建,但不会
提到实际推荐的方法.
手动指定每个源文件有一点点手动
对我来说.那么,收集源文件的方法是什么呢?
文件(GLOB …)?
手册确实是推荐的方法.通过建议不要使用GLOB,文档只是针对依赖于文件的构建系统进行警告.例如,您要添加一个测试可执行文件,因此您可以创建mytest.cpp.哎呀.现在你的图书馆编译了. AUX_SOURCE_DIRECTORY的文档(与源文件的globbing类似的目的)给出以下警告:
It is tempting to use this command to avoid writing the list of source files for a library or executable target. While this seems to work, there is no way for CMake to generate a build system that knows when a new source file has been added. Normally the generated build system knows when it needs to rerun CMake because the CMakeLists.txt file is modified to add a new source. When the source is just added to the directory without modifying this file, one would have to manually rerun CMake to generate a build system incorporating the new file.
如果您确定要使用目录的所有内容,并且不打算添加新的目录,那么一定要使用GLOB.
此外,不要忘记手动列出文件不必涉及所有文件名的打字.你可以做,例如,ls * .cpp>> CMakeLists.txt,然后使用您的编辑器将文件列表移动到文件中正确的位置.
http://stackoverflow.com/questions/10914607/how-to-collect-source-files-with-cmake-without-globbing
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming Ruby中文版
托马斯 / 孙勇、姚延栋、张海峰 / 电子工业出版社 / 2007-3 / 99.00元
《Programming Rudy》(中文版)(第2版)是它的第2版,其中包括超过200页的新内容,以及对原有内容的修订,涵盖了Ruby 1.8中新的和改进的特性以及标准库模块。它不仅是您学习Ruby语言及其丰富特性的一本优秀教程,也可以作为日常编程时类和模块的参考手册。Ruby是一种跨平台、面向对象的动态类型编程语言。Ruby体现了表达的一致性和简单性,它不仅是一门编程语言,更是表达想法的一种简......一起来看看 《Programming Ruby中文版》 这本书的介绍吧!