用法演示一(文本宏):
ADD_DEFINITIONS(-DDEBUG)
用法演示二(常量宏)
ADD_DEFINITIONS(-DVERSION=1)
ADD_DEFINITIONS: Adds -D define flags to the command line of C and C++ compilers.
ADD_DEFINITIONS(-DFOO -DBAR ...)
Adds flags to command line of C and C++ compilers. This command can be used to add any flag to a compile line, but the -D flag is accepted most C/C++ compilers. Other flags may not be as portable.
本文介绍了CMake中ADD_DEFINITIONS宏的基本用法及其在C/C++编译过程中的作用。通过两个实例展示了如何使用该宏来添加调试信息及版本号等预处理指令。
454

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



