diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/ECMAddAppIcon.cmake | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/modules/ECMAddAppIcon.cmake b/modules/ECMAddAppIcon.cmake index 06926800..7207c66e 100644 --- a/modules/ECMAddAppIcon.cmake +++ b/modules/ECMAddAppIcon.cmake @@ -90,6 +90,31 @@ function(ecm_add_app_icon appsources)          message(FATAL_ERROR "Unexpected arguments to ecm_add_app_icon: ${ARG_UNPARSED_ARGUMENTS}")      endif() +    if(APPLE) +        find_program(KSVG2ICNS NAMES ksvg2icns) +        foreach(icon ${ARG_ICONS}) +            get_filename_component(icon_full ${icon} ABSOLUTE) +            get_filename_component(icon_type ${icon_full} EXT) +            # do we have ksvg2icns in the path and did we receive an svg (or compressed svg) icon? +            if(KSVG2ICNS AND (${icon_type} STREQUAL ".svg" OR ${icon_type} STREQUAL ".svgz")) +                # convert the svg icon to an icon resource +                execute_process(COMMAND ${KSVG2ICNS} "${icon_full}" +                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE KSVG2ICNS_ERROR) +                if(${KSVG2ICNS_ERROR}) +                    message(AUTHOR_WARNING "ksvg2icns could not generate an OS X application icon from ${icon}") +                else() +                    # install the icns file we just created +                    get_filename_component(icon_name ${icon_full} NAME_WE) +                    set(MACOSX_BUNDLE_ICON_FILE ${icon_name}.icns PARENT_SCOPE) +                    set(${appsources} "${${appsources}};${CMAKE_CURRENT_BINARY_DIR}/${icon_name}.icns" PARENT_SCOPE) +                    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${icon_name}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +                    # we're done now +                    return() +                endif() +            endif() +        endforeach() +    endif() +      set(known_sizes 16 32 48 64 128 256 512 1024)      foreach(size ${known_sizes})          set(icons_at_${size}px) | 
