add EXE Icon
-
I want to add exe icon with cmake. I use qtcreator and I can give icon to mainwindow but I want to set to exe. How could I do it?
-
This is platform-dependent and is described here:
-
@Pl45m4 yes I read there but I do not understand.
firstly I create rc file also I have qrc file and, I add that line the rc file.
IDI_ICON1 ICON "Resources/images/myappico.ico"
.After rc file will be added to cmake.
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/qt5app.rc") add_executable(qt5app main.cpp ${APP_ICON_RESOURCE_WINDOWS})
(That step create new layer on project)
It is very complex and not understanable. Is my step right ?
-
@Joe-von-Habsburg said in add EXE Icon:
IDI_ICON1 ICON "Resources/images/myappico.ico"
This is from the guide's
qmake
section
[Edit: but it's an overall resource example actually]This:
set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/resources/photosurface.rc") qt_add_executable(photosurfaceexample main.cpp ${app_icon_resource_windows})
and a resource file which contains your icon should work with
cmake
.How you create the resource file is also linked and explained here:
Just read that you only use QtCreator and not Visual Studio.
-
@Pl45m4 said in add EXE Icon:
photosurface.rc
what is that mean ? I realy do not know. I have .ico file. and how can I convert my ico file to rc file.
@Pl45m4 said in add EXE Icon:
How you create the resource file is also linked and explained here:
https://learn.microsoft.com/en-us/windows/win32/menurc/about-resource-files
thank you, I will check
-
@Joe-von-Habsburg said in add EXE Icon:
what is that mean ? I realy do not know. I have .ico file. and how can I convert my ico file to rc file.
This was the example from here:
The Microsoft link is only relevant, when you use Visual Studio to create your resource file.
Even this is in the
qmake
section, I think it will work for you as.rc
fileIDI_ICON1 ICON "path/to/myappico.ico"
-
@Joe-von-Habsburg said in add EXE Icon:
firstly I create rc file also I have qrc file and, I add that line the rc file.
IDI_ICON1 ICON "Resources/images/myappico.ico"
.After rc file will be added to cmake.
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/qt5app.rc") add_executable(qt5app main.cpp ${APP_ICON_RESOURCE_WINDOWS})
This is actually right. Did you not make it?
Not quite understand your qrc part though, rc file and qrc file are totally irrelevant. -
@Bonnie said in add EXE Icon:
Did you not make it?
Yes I did now :)Thank you so much for your helping
IDI_ICON1 ICON "Resources/images/myapp.ico"
.rc file has been created by notepad
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/icon.rc") if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(MyApp MANUAL_FINALIZATION ${PROJECT_SOURCES} ${QM_FILES} ${APP_ICON_RESOURCE_WINDOWS} ... icon.rc )
-