瀏覽

  • 索引
  • 下一頁 |
  • 上一頁 |
  • CMake 4.5.20261019-g7ed8fa4 »
  • 文件 »
  • cmake-屬性(7) »
  • CMAKE_LINK_WRAPPER_<NAME>

CMAKE_LINK_WRAPPER_<NAME>¶

在 4.5 版被加入.

Command line to be prepended to link commands.

This property holds a command line to be used with the LINK_WRAPPERS and/or INTERFACE_LINK_WRAPPERS target properties. Named values in those properties (which are semicolon-separated lists) will reference the correspondingly-named CMAKE_LINK_WRAPPER_<NAME> and prepend the link command for the output artifact of the given target or its consumer(s) with the value of this property.

This property is supported only by Makefile 生成器 and Ninja 生成器, and is ignored by other generators.

The value is a semicolon-separated list of command line arguments. Empty arguments are preserved, and a literal semicolon within an argument may be written as \;.

Contents of CMAKE_LINK_WRAPPER_<NAME> may use generator expressions with the syntax $<...>. See the cmake-buildsystem(7) manual for more on defining buildsystem properties.

範例¶

add_library(iface INTERFACE)
add_executable(main main.c)
target_link_libraries(main PRIVATE iface)

set_property(GLOBAL
  PROPERTY CMAKE_LINK_WRAPPER_2_PYTHON_WRAPPER
    "${Python_EXECUTABLE}" my_wrapper.py
)
set_property(GLOBAL
  PROPERTY CMAKE_LINK_WRAPPER_1_TIME
    "${CMAKE_COMMAND}" -E time
)

set_target_properties(iface PROPERTIES
  INTERFACE_LINK_WRAPPERS 1_TIME
)
set_target_properties(main PROPERTIES
  LINK_WRAPPERS 2_PYTHON_WRAPPER
)

Here, the link command for main will look like:

/path/to/cmake -E time /path/to/python my_wrapper.py ...

另請參見¶

  • CMAKE_COMPILE_WRAPPER_<NAME>

  • INTERFACE_LINK_WRAPPERS

  • LINK_WRAPPERS

  • <LANG>_LINKER_LAUNCHER

目次表

  • CMAKE_LINK_WRAPPER_<NAME>
    • 範例
    • 另請參見

上個話題

CMAKE_HIP_KNOWN_FEATURES

下個話題

CMAKE_SYCL_KNOWN_FEATURES

本頁

  • 顯示來源碼

快速搜尋

瀏覽

  • 索引
  • 下一頁 |
  • 上一頁 |
  • CMake 4.5.20261019-g7ed8fa4 »
  • 文件 »
  • cmake-屬性(7) »
  • CMAKE_LINK_WRAPPER_<NAME>
© 著作權 2000-2026 Kitware, Inc. and Contributors. 使用 Sphinx 8.1.3 建立。