make install, also CPack, on MacOSX seem to reset a bundle directory's icon
I am using a command line utility (fileicon https://github.com/mklement0/fileicon) to set the image for a 'bundle' folder in MacOSX.
./fileicon set MyPlugin.vst image.png
It seems to add an Icon^M file to the root of the bundle with weird \r control character in it. Some kind of native MacOSX feature. Dont confuse this with "Bundle image" set in Info.plist
, I have that set up and working if I rename the bundle
to MyPlugin.app
, but it's a VST Plugin for audio software, so it's named MyPlugin.vst/
- so MacOSX doesn't use the Info.plist - so I have to resort to using an OS feature to set the image on the folder instead.
I can cp -r
and tar -zxvf
this bundle and the image stays on the new copy. But as soon as I make install
, the new installed copy of the bundle no longer has the Icon set on it.
I can add post install stuff to rerun the fileicon
command on the installed bundle
. But then when CPack runs (DragNDrop, TGZ, or productbuild generators), it blows away the icon again.
Relevant lines from CMakeLists.txt
:
# make
add_library(${PROJECT_NAME} MODULE ${SOURCES} ${RESOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES BUNDLE true BUNDLE_EXTENSION "vst")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND fileicon set ${PROJECT_NAME}.vst image.png
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "..."
)
# make install
install(DIRECTORY "${PROJECT_NAME}.vst" DESTINATION "install" COMPONENT vstplugin)
install( SCRIPT "PostInstall.cmake" COMPONENT vstplugin)
# make package
set(CPACK_GENERATOR "DragNDrop;TGZ;productbuild")
Here is PostInstall.cmake
, which is required or else make install
will strip off the icon from the bundle folder.
execute_process( COMMAND fileicon set install/MyPlugin.vst image.png )
Running make
generates MyPlugin.vst
directory with the image on it, (the add_custom_command
step sets it), looks perfect.
Running make install
copies the bundle folder using install( DIRECTORY
, which strips the image, so I compensate with the PostInstall.cmake
which reruns fileicon
script from execute_process
. Looks Perfect. (NOTE that install(TARGETS ${PROJECT_NAME} BUNDLE
also strips the image from the folder, I tried that too.)
Running make package
, the CPack
packager generates the .dmg
, the .pkg
, and the .tgz
, which strips the folder image again... But I have no way to post process this one... :-(
Any ideas why CMake
install
and package
is stripping the image? (and how to get them to not do that?)
Attached files: