It's possible to request a CMake script to be run at installation time, with e.g.
I think this is most commonly used for fixing up bundles generating during install time (e.g. rpath munging or other muckery). Within such a script, I'd like to execute a shell script that does the heavy lifting, e.g. within the above script I might have:
execute_process(COMMAND sh <script>.sh)
I'd like to have this bash script run within the install directory. It seems like one can get this directory with e.g.
For what it's worth, I'm trying this out on Linux when using CPack to generate DEB/RPM packages, and all seems well so far, but I suspect there may be a simpler, or more idiomatic, way to accomplish what I'm trying to do.
tl;dr: Is there a portable way to get the path to the directory being used during the install phase? Or do I need to rethink the way I'm approaching this?