Results 1 to 2 of 2

Thread: Auto-detect dependencies for make

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Auto-detect dependencies for make

    When qmake generates a make file, I think that it must specify which files depend on others, so that the compiler knows which source files need to be recompiled.

    For example, suppose I have

    Qt Code:
    1. HEADERS = foo.h bar.h
    2. SOURCES = foo.cpp
    To copy to clipboard, switch view to plain text mode 

    and in foo.cpp, I have

    Qt Code:
    1. #include "foo.h"
    2. #include "bar.h"
    3. ...
    To copy to clipboard, switch view to plain text mode 

    If bar.h is modified, then foo.cpp is recompiled upon make.

    Here's my question. What if I don't want bar.h to appear in the HEADERS variable? Then foo.cpp will not be recompiled when bar.h is modified . Is there a way for me to tell qmake to please look at bar.h --- but don't run moc on it?

  2. #2
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Auto-detect dependencies for make

    I think I have solved my own problem.

    I was mistaken in my previous post.... this has nothing to do with which files appear in the HEADERS variable. It has a lot to do with the DEPENDPATH variable.

    But it's not so straightforward. If somebody could write a detailed explanation of the rules for which files get recompiled when, that would be very useful.

    The reason that this is important, is that if a header file changes and a library or plugin does not get recompiled, it can lead to an unexpected program crash.

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
  •  
Qt is a trademark of The Qt Company.