Hi, It's possible to request a CMake script to be run at installation time, with e.g.
install(SCRIPT <script>.cmake) 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. $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX} but this sort of usage seems somewhat thinly documented. https://cmake.org/cmake/help/v3.10/variable/CMAKE_INSTALL_PREFIX.html 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 ( https://cmake.org/Wiki/CMake:CPackNSISAdvancedTips): ${CMAKE_BINARY_DIR}\_CPack_Packages\${CPACK_TOPLEVEL_TAG}\${CPACK_GENERATOR}\ 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? Thanks, Kevin
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake