Results 1 to 3 of 3

Thread: How to add a dependency to a windres-ressource (rc) file w/ mingw

  1. #1
    Join Date
    Aug 2010
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default How to add a dependency to a windres-ressource (rc) file w/ mingw

    Hi, I am developing a windows application where I have the need of having a Program version included:

    1. As Infowidget in the program itself (About..)
    2. As Version information in the .exe binary when looking from the file explorer's view


    At this point everthing is solved using a version.rc file that is compiled by the windres compiler. In this file included I have a version.h file that defines every version for my program. The advantage of this solution is to have only one file (the version.h) to be changed in my source code.

    Qt Code:
    1. // version.h
    2.  
    3. #define STRFILEVER "0.1.0.6\0"
    4. #define FILEVER 0,1,0,6
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // version.rc
    2.  
    3. #include "version.h"
    4. #include "icon.rc"
    5.  
    6. ...
    7.  
    8. BLOCK "StringFileInfo"
    9. BEGIN
    10. BLOCK "040904B0"
    11. BEGIN
    12. VALUE "FileDescription", "My Application\0"
    13. VALUE "FileVersion", STRFILEVER
    14. VALUE "LegalCopyright", "Copyright (c) 2010\0"
    15. VALUE "OriginalFilename", "App.exe\0"
    16. VALUE "ProductName", "MyApp\0"
    17. END
    18. END
    19. ...
    To copy to clipboard, switch view to plain text mode 

    Now to the question. qmake will not automatically set the version.h file as a dependency in the makefiles for the version.rc file so I will always have to tag version.rc manually.

    Is there a way to tell qmake to reflect version.h in the dependencies of version.rc ? How can I add custom dependencies to a certain file that is no library but (in my case) a ressource file.

    Any comments ?

  2. #2
    Join Date
    Apr 2015
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to add a dependency to a windres-ressource (rc) file w/ mingw

    I know it's been a while, but I got almost the same problem. Did you find any solution or you just redesigned your code?
    To clarify, I have version.h file that is being generated with
    Qt Code:
    1. PRE_TARGETDEPS += version.h
    To copy to clipboard, switch view to plain text mode 
    and rc file that has version.h included in it
    Qt Code:
    1. RC_FILE += resource.rc
    To copy to clipboard, switch view to plain text mode 
    The problem is when I am building the project using several cores it executes resource generation and version.h at the same time and sometimes the version file is not generated yet when winres tries to include it. I need to set up some kind of dependency so version.h would be generated before resource file.
    Thanks.
    Last edited by sr2020; 13th April 2015 at 20:10.

  3. #3
    Join Date
    Aug 2010
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to add a dependency to a windres-ressource (rc) file w/ mingw

    The following works with (and most likely with former versions as well):
    QMake version 3.0
    Using Qt version 5.1.1

    Qt Code:
    1. #call the ressource compiler
    2. win32:mkver_rc.target = version_res.o
    3. win32:mkver_rc.depends = version.h
    4. win32:mkver_rc.commands = windres -i version.rc -o version_res.o --include-dir=. -DVERSION_H_INTERN $(DEFINES)
    5. win32:QMAKE_EXTRA_TARGETS += mkver_rc
    6. win32:PRE_TARGETDEPS += version_res.o
    7.  
    8. LIBS += version_res.o
    To copy to clipboard, switch view to plain text mode 

    Please check if you should remove the two lines you mentioned above from your project file.

Similar Threads

  1. dependency file for Qt application to deploy
    By rajeshs in forum Installation and Deployment
    Replies: 5
    Last Post: 11th August 2008, 10:59
  2. MingW and pro file!!
    By Raajesh in forum Qt Programming
    Replies: 2
    Last Post: 17th June 2008, 15:38
  3. QCheckBox dependency
    By jd in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2008, 14:12
  4. Replies: 2
    Last Post: 8th March 2007, 22:47
  5. DLL dependency?
    By duschl in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2006, 18:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.