Makefile CMakeList.txt文件打印调试

1. Makefile

可以根据需要灵活选择warning或者error打印相关变量

1.1 警告

$(warning xxxxx)  
$(warning  $(XXX))

在终端输出行号,及打印信息,不会终止编译过程

1.2 报错

$(error xxxxx)  
$(error $(XXX))

在终端输出行号,及打印信息,同时终止编译过程。

2. CMakeList.txt

2.1 警告

message(WARNING "message text")

2.2 报错

# FATAL_ERROR: CMake Error, stop processing and generation.
# SEND_ERROR: CMake Error, continue processing, but skip generation.

message(FATAL_ERROR "message text")

3. 调试确认Makefile被include了两次

在需要调试的文件头部加类似以下的信息:

LGDEBUG为自定义的与Makefile中其他变量不重名的变量,component.mk为我要调试的Makefile。

ifeq ($(LGDEBUG), )
  $(warning enter component.mk first time)
  LGDEBUG = COMPONENT_DEBUG
else 
  $(error enter component.mk second time)
endif 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值