Results 1 to 3 of 3

Thread: qmake: create a dependency to an arbitrary file.

  1. #1
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default qmake: create a dependency to an arbitrary file.

    Hi,

    I want to create a dependency between a file in my project and an arbitrary other file that may or may not be in the project. Say for example foo.cpp is dependent /etc/passwd. This is pretty much basic `make` but I can't figure out how to do this from qmake.

    To clarify; qmake will generate a makefile with the following lines:
    Qt Code:
    1. ...
    2. all: Makefile $(TARGET)
    3.  
    4. $(TARGET): $(OBJECTS)
    5. ...
    To copy to clipboard, switch view to plain text mode 
    I want to add an arbitrary dependency to $(TARGET). So its becomes:

    Qt Code:
    1. ...
    2. all: Makefile $(TARGET)
    3.  
    4. $(TARGET): $(OBJECTS) /etc/passwd
    5. ...
    To copy to clipboard, switch view to plain text mode 

    Thanks.
    Last edited by 33333; 28th June 2014 at 07:20.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,625
    Thanks
    13
    Thanked 1,592 Times in 1,520 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: qmake: create a dependency to an arbitrary file.

    Either PRE_TARGETDEPS or POST_TARGETDEPS:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. PRE_TARGETDEPS += doit_before
    6. POST_TARGETDEPS += doit_after
    7.  
    8. # Input
    9. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 
    generates:
    Qt Code:
    1. ...
    2. all: Makefile $(TARGET)
    3.  
    4. $(TARGET): doit_before $(OBJECTS) doit_after
    5. $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
    6. ...
    To copy to clipboard, switch view to plain text mode 
    and if doit_before or doit_after are files changing them has the desired effect of rebuilding the target.

  3. #3
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: qmake: create a dependency to an arbitrary file.

    To easy! Thx.

Similar Threads

  1. Replies: 2
    Last Post: 27th June 2014, 00:36
  2. qmake option to create pro file from vs2005 .sln
    By dpatel in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2010, 06:45
  3. Replies: 1
    Last Post: 10th March 2010, 10:12
  4. making qmake create VisualStudio console app project file?
    By akos.maroy in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2008, 14:45
  5. qmake+flex dependency problem
    By nurtsi in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2008, 08:11

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.