例子:
为了规范代码写了如下CMakeLists
#############################################################################################################################
#Files include
#############################################################################################################################
file(
GLOB
source_files
*.c
*h
)
本意是在工程中添加.h.c会自动加入工程并编译执行
但是由于后期没有修改CMakeLists导致不会新生成Makefile,进而新加的文件不会被编译执行!!
参考一下说明
GLOB will generate a list of all files that match the globbing expressions and store it into the variable. Globbing expressions are similar to regular expressions, but much simpler. If RELATIVE flag is specified for an expression, the results will be returned as a relative path to the given path. (We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)