Skip to content

Instantly share code, notes, and snippets.

@foxoman
Forked from Niakr1s/cmake_windows_icon.txt
Last active October 31, 2021 18:49
Show Gist options
  • Save foxoman/7d2b1efd64bff7e62fea3063b66784df to your computer and use it in GitHub Desktop.
Save foxoman/7d2b1efd64bff7e62fea3063b66784df to your computer and use it in GitHub Desktop.
How to add icon to cmake app in windows
1. Put app.ico in directory.
2. Create app.rc in same directory with one line:
IDI_ICON1 ICON DISCARDABLE "app.ico"
3. Run command (Warning: it's app.o, not app.res, how it is mentioned in other manuals!)
// in windows
windres app.rc -o app.o
// in linux
/mxe/usr/bin/i686-w64-mingw32.static-windres app.rc -o app.o
4. add_executable(app
...
app.o
)
5. Proofit!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment