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
本文详细介绍了如何在Makefile和CMakeList.txt中使用警告和错误指令来控制编译过程,包括如何根据需要选择打印warning或error,并通过实例展示了调试Makefile被多次include的方法。
596

被折叠的 条评论
为什么被折叠?



