ECMAddAppIcon — Extra CMake Modules Documentation

### Navigation

- index
- next |
- previous |
- Documentation »
- ecm-modules(7) »

# ECMAddAppIcon

Add icons to executable files and packages.

    ecm_add_app_icon(<sources_var>
                     ICONS <icon> [<icon> [...]])

The given icons, whose names must match the pattern:

    <size>-<other_text>.png

will be added to the executable target whose sources are specified by `<sources_var>` on platforms that support it (Windows and Mac OS X).

`<size>` is a numeric pixel size (typically 16, 32, 48, 64, 128 or 256). `<other_text>` can be any other text. See the platform notes below for any recommendations about icon sizes.

Windows notes
  - Icons are compiled into the executable using a resource file.
  - Icons may not show up in Windows Explorer if the executable target does not have the `WIN32_EXECUTABLE` property set.
  - The tool png2ico is required. See `FindPng2Ico`.
  - Supported sizes: 16, 32, 48, 64, 128.
Mac OS X notes
  - The executable target must have the `MACOSX_BUNDLE` property set.
  - Icons are added to the bundle.
  - The tool iconutil (provided by Apple) is required.
  - Supported sizes: 16, 32, 64, 128, 256, 512, 1024.
  - At least a 128x128px icon is required.
  - Larger sizes are automatically used to substitute for smaller sizes on “Retina” (high-resolution) displays. For example, a 32px icon, if provided, will be used as a 32px icon on standard-resolution displays, and as a 16px-equivalent icon (with an “@2x” tag) on high-resolution displays.
  - This function sets the `MACOSX_BUNDLE_ICON_FILE` variable to the name of the generated icns file, so that it will be used as the `MACOSX_BUNDLE_ICON_FILE` target property when you call `add_executable`.

Since 1.7.0.

### Navigation

- index
- next |
- previous |
- Documentation »
- ecm-modules(7) »