CMake:set

编程入门 行业动态 更新时间:2024-10-26 17:25:47
本文介绍了CMake:set_property(TARGET ...)和set_target_properties之间有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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()

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

    本文发布于:2023-10-29 02:52:00,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1538515.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:CMake   set

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!