[CMake] Setting the and Icon for a Windows Executable

Michael Jackson mike.jackson at bluequartz.net
Fri Aug 21 16:56:09 EDT 2009


THANKS!
    Just what I was looking for. Got it working now.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net

On Aug 21, 2009, at 4:10 PM, David Cole wrote:

> The resource compiler uses the same include directories as the C++  
> compiler.
>
> So, if ${PROJECT_SOURCE_DIR} is in your include directories list,  
> then reference it as "Resources\\icons\\ico\\Project.ico"
>
> If IDI_ICON1 is not defined, then the resource compiler still works  
> and does not complain, but the icon is identified by a string  
> instead of a number. If you open up the executable with the  
> "resource editor" of Visual Studio you will see it labeled with a  
> double-quoted string : "IDI_ICON1"
>
>
>
> On Fri, Aug 21, 2009 at 3:55 PM, Michael Jackson <mike.jackson at bluequartz.net 
> > wrote:
> I was actually looking for the procedure for Qt 4.5. I think I found  
> what I need in the CMake sources but in the CMakeSetup.rc file there  
> is the following:
>
> IDI_ICON1   ICON  DISCARDABLE  "CMakeSetup.ico"
>
> I grepped for IDI_ICON1 but didn't find anything being defined any  
> where. Also, if my icon is located in ${PROJECT_SOURCE_DIR}/ 
> Resources/icons/ico/Project.ico what would be the correct way to  
> reference that in the .rc file?
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
>
>
> On Aug 21, 2009, at 3:48 PM, David Cole wrote:
>
> Add a *.rc file to your ADD_EXECUTABLE sources.
>
> In the *.rc file, add a line that references the ico file:
> IDR_MAINFRAME           ICON                    "res\ 
> \CMakeSetupDialog.ico"
>
> (In this example, IDR_MAINFRAME is a #define that gives an integer  
> identifier for the ico resource.)
>
> See CMake/Source/MFCDialog/CMakeLists.txt and CMakeSetup.rc for an  
> example.
>
>
> HTH,
> David
>
>
> On Fri, Aug 21, 2009 at 3:33 PM, Michael Jackson <mike.jackson at bluequartz.net 
> > wrote:
> What would be the "cmake" way of setting an icon (.ico file) as the  
> icon for an executable?
>
>
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net



More information about the CMake mailing list