I have a CMakeLists.txt script that builds a MACOSX_BUNDLE
executable, though I'm having difficulty finding the 'right way' to get the icon file into the bundle's resource directory. I set the icon bundle properties with the following:
# set icon
set( ICON_NAME "MyApp.icns" )
set( ICON_PATH "${PROJECT_SOURCE_DIR}/../data/${ICON_NAME}" )
set_target_properties( MyApp PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME} )
It appears the correct way (as found in this existing post) should be:
set_source_files_properties( ${ICON_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
However, there is no MyApp.app/Contents/Resources, nor copied MyApp.icns.. The following is (in my opinion) a workaround:
file( COPY ${ICON_PATH} DESTINATION "MyApp.app/Contents/Resources/" )
As I'll often be copying things into the resouces folder, I'd rather do it the 'right way', but can anyone tell why this doesn't work as I've done it above?