<div dir="ltr">Hi,<br><br>It's possible to request a CMake script to be run at installation time, with e.g.<br><br>    install(SCRIPT <script>.cmake)<br><br>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:<br><br>    execute_process(COMMAND sh <script>.sh)<br><br>I'd like to have this bash script run within the install directory. It seems like one can get this directory with e.g.<br><br>    $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}<br><br>but this sort of usage seems somewhat thinly documented. <a href="https://cmake.org/cmake/help/v3.10/variable/CMAKE_INSTALL_PREFIX.html">https://cmake.org/cmake/help/v3.10/variable/CMAKE_INSTALL_PREFIX.html</a> suggests DESTDIR can be used when one is using 'make' to build the project, but I'm guessing this may not be portable to other generators. For example, NSIS suggests that the following build directory is used (<a href="https://cmake.org/Wiki/CMake:CPackNSISAdvancedTips">https://cmake.org/Wiki/CMake:CPackNSISAdvancedTips</a>):<br><br>    ${CMAKE_BINARY_DIR}\_CPack_Packages\${CPACK_TOPLEVEL_TAG}\${CPACK_GENERATOR}\<br><br>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.<br><br>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?<br><br>Thanks,<br>Kevin<br></div>