Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Cmake add application icon for windows

Cmake add application icon for windows

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChortleMortal
    wrote on last edited by
    #1

    I know there are numerous postings on this subject, but I cant make any sense of what is being said.

    Using qmake I have the following line in my .pro file
    win32:RC_ICONS += dac1.ico

    What is the equivalent for cmake??

    I am reading about adding icons in .qrc files, but this seems to be only for loading icons on widgets generated in the app. I am trying to set the icon that represents the .exe file and also magically shows up on all top level widgets. Do I need to make a .rcc file. If so, what would that file look like.

    Any help would be welcome.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You will have to create your own rc file as e.g. explained here: http://cmake.3232098.n2.nabble.com/Setting-the-and-Icon-for-a-Windows-Executable-td3492141.html

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • C Offline
        C Offline
        ChortleMortal
        wrote on last edited by
        #3

        Thanks for your advice. I have got it working. For others who may have this problem:

        1. I created a file called icon.rc with the following two lines
          #include <windows.h>
          IDI_ICON1 ICON "dac1.ico"

        2. I added icon.rc to the call to qt_add_executable().

        Note: It does not work if icon.rc is added to the qt_add_resources() call which is used when adding a Qt .qrc file)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved