CMAKE_LINK_WRAPPER_<NAME>¶
Added in version 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 Generators and Ninja Generators, 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.
Example¶
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 ...