在CMake中,假设只是设置一个属性,
In CMake, assuming one is just setting one property, is there any difference between
set_target_properties(target PROPERTIES prop value)和
set_property(TARGET target PROPERTY prop value)?
Cf。
https: //cmake/cmake/help/v3.0/command/set_property.html cmake/cmake/help/v3.0/command/set_target_properties.html
推荐答案
考虑 set_target_properties()作为 set_property()的特殊形式。
Consider set_target_properties() as a specialized form of set_property().
-
set_target_properties(...)是一个便捷功能,因为它允许设置多个目标的多个属性。
set_target_properties(...) is a convenience function because it allows to set multiple properties of multiple targets.
例如:
add_executable(a ...) add_executable(b ...) set_target_properties( a b PROPERTIES LINKER_LANGUAGE CXX FOLDER "Executable" )
set_property(TARGET ...) 可以 APPEND 到列表,或 APPEND_STRING 到目标的基于字符串的属性。
set_property(TARGET ...) can APPEND to a list- or APPEND_STRING to a string-based property of targets.
例如:
add_executable(a ...) set_property( TARGET a APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" )
- 如何将输出二进制文件的名称更改为not
- 2.8.12之前的target_include_directories?
- 使用CMake将编译器标志附加到文件中
- How to change the name of the output binary to not be a.out with CMake?
- target_include_directories prior to 2.8.12?
- Appending compiler flags to a file with CMake
更多推荐
CMake:set
发布评论