[CMake] Setting the and Icon for a Windows Executable

David Cole david.cole at kitware.com
Fri Aug 21 16:10:29 EDT 2009


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
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
> 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
>> Principal Software Engineer                  Dayton, Ohio
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090821/281cb3f2/attachment.htm>


More information about the CMake mailing list