CMakeLists 中file GLOB的陷阱:undefined symbol错误

例子:

为了规范代码写了如下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.)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值