【发布时间】:2019-10-18 18:32:39
【问题描述】:
我想为我的 CMake 构建创建一个“安装后”脚本,但为此我需要给定目标的安装位置。
例如:
function(post_install_target target)
set(target_install_loc ???) # Somehow
message("Target install location is ${target_install_loc}")
endfunction(post_install_target)
# ...
post_install_target(A) # Some target defined elsewhere.
这可以打印:
-- Target install location is /usr/local/lib/libA.so
我已经尝试过this answer,(通过使用$<TARGET_FILE:tgt>)但结果是构建树中的位置,而不是安装树中的位置(即它打印/home/me/project/build/libA.so)。
【问题讨论】:
标签: cmake