mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
6a3922bebe
The purpose of this new `IMPORTED_GLOBAL` target-property is to prolong the lifetime and scope of `IMPORTED` targets in such a way as if they had been created with the keyword `GLOBAL` in the first place. * It can only be set to `TRUE`. That means, a local `IMPORTED` target can be promoted to global scope but a global `IMPORTED` target cannot be degraded to local scope! * Setting it to `TRUE` only succeeds if done from within the same directory in which the `IMPORTED` target was created in the first place. Fixes #17256.
26 lines
806 B
CMake
26 lines
806 B
CMake
function (check_target_property target prop)
|
|
get_target_property(gtp_val "${target}" "${prop}")
|
|
get_property(gp_val
|
|
TARGET "${target}"
|
|
PROPERTY "${prop}")
|
|
|
|
message("get_target_property: -->${gtp_val}<--")
|
|
message("get_property: -->${gp_val}<--")
|
|
endfunction ()
|
|
|
|
add_custom_target(tgt)
|
|
set_target_properties(tgt PROPERTIES empty "" custom value)
|
|
|
|
check_target_property(tgt empty)
|
|
check_target_property(tgt custom)
|
|
check_target_property(tgt noexist)
|
|
check_target_property(tgt SOURCE_DIR)
|
|
check_target_property(tgt BINARY_DIR)
|
|
|
|
add_library(imported_local_tgt SHARED IMPORTED)
|
|
add_library(imported_global_tgt SHARED IMPORTED GLOBAL)
|
|
|
|
check_target_property(tgt IMPORTED_GLOBAL)
|
|
check_target_property(imported_local_tgt IMPORTED_GLOBAL)
|
|
check_target_property(imported_global_tgt IMPORTED_GLOBAL)
|