COMPILE_FLAGS和COMPILE_OPTIONS之间的区别 [英] Difference between COMPILE_FLAGS and COMPILE_OPTIONS
问题描述
What is the difference between
COMPILE_FLAGS和有什么区别?
COMPILE_FLAGS: Additional flags to use when compiling this target's sources.
和
COMPILE_OPTIONS:传递给编译器的选项列表。 / p>
COMPILE_OPTIONS: List of options to pass to the compiler.
对于最终的VS2010解决方案,这些命令产生的结果相同:
In terms of resulting VS2010 solution these commands produce the same result:
target_compile_options(target PRIVATE "/option=test1")
set_target_properties(target PROPERTIES COMPILE_FLAGS "/option=test1")
set_target_properties(target PROPERTIES COMPILE_OPTIONS "/option=test1")
推荐答案
COMPILE_OPTIONS
是一个列表,但 COMPILE_FLAGS
是一个字符串。
COMPILE_OPTIONS
is a list, but COMPILE_FLAGS
is a string.
set_target_properties(target PROPERTIES
COMPILE_OPTIONS "/option=test1;/option2=test2")
set_target_properties(target PROPERTIES
COMPILE_FLAGS "/option=test1 /option2=test2")
与列表相比,您可以更轻松地附加到列表。
You can more-easily append to a list than to a string.
此外, COMPILE_OPTIONS
已正确转义,而 COMPILE_FLAGS $ c中的某些字符$ c>可能需要手动转义或导致问题。
Also, COMPILE_OPTIONS
is properly escaped, whereas some characters in COMPILE_FLAGS
may need to be escaped manually or cause problems.
这篇关于COMPILE_FLAGS和COMPILE_OPTIONS之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!