I would like to create a "post-install" script for my CMake build, but for this I need the install location for a given target.
For example:
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.
This could print:
-- Target install location is /usr/local/lib/libA.so
I already tried this answer, (by using $<TARGET_FILE:tgt>
) but the result is the location in the build tree, not in the install tree (i.e. it prints /home/me/project/build/libA.so
).