cmake的四个命令:add_compile_options、add_definitions、target_compile_definitions、build_command
add_compile_options()
Adds options to the compilation of source files.
增加源文件的编译选项。
add_compile_options(<option> ...)
Adds options to the compiler command line for targets in the current directory and below that are added after this command is invoked. See documentation of the directory and target COMPILE_OPTIONS properties.
为当前路径和下层路径的目标增加编译器命令行选项,选项在此命令被调用后添加。查看文档中关于路径和目标的 COMPILE_OPTIONS 属性。
This command can be used to add any options, but alternative commands exist to add preprocessor definitions (target_compile_definitions() and add_definitions()) or include directories (target_include_directories() and include_directories()).
这个命令可以被用来添加任何的选项,但是存在替代命令(target_compile_definitions() 和 add_definitions())增加预处理定义或(target_include_directories() 和 include_directories())包含路径。
Arguments to add_compile_options may use “generator expressions” with the syntax $<...>. See the cmake-generator-expressions(7) manual for available expressions. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.
add_compile_options的参数可以使用带语法$<...>的“生成表达式”。关于有效的表达式可以查看cmake-generator-expressions(7)手册。关于更多的系统属性的定义可以查看cmake-buildsystem(7)助手。
add_definitions()
Adds -D define