CPack: can't generate DS_Store with CPACK_DMG_DS_STORE_SETUP_SCRIPT
I'm trying to generate nice looking DMG with background using DragNDrop on macOS Sierra with CMake 3.9.0. Problem that I can't use pre-generated DS_Store file because path to background image is absolute and it's break every time disk name is changed.
So I find CPACK_DMG_DS_STORE_SETUP_SCRIPT option and script CMake is using: https://gitlab.kitware.com/cmake/cmake/blob/master/Packaging/CMakeDMGSetup.scpt
Problem that when I try to run CPack I getting following error:
CPack: Create package
CPack Error: Error executing: osascript "/Users/admin/dev/vcmi/osx/CMakeDMGSetup.scpt" "vcmi-0.99"
CPack Error: Error executing custom script on disk image.
/Users/admin/dev/vcmi/osx/CMakeDMGSetup.scpt:968:972: execution error: Finder got an error: Application isn’t running. (-600)
When I mount writable DMG and run script exactly same way it's works fine. Finder is opened, window is resized and icons are moved where they should. In both cases I run CPack and script over SSH and just watch what's happening on screen.