Results 1 to 4 of 4

Thread: Dependencies maintenance headache

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    19
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Dependencies maintenance headache

    Greetings.
    I'm using QtCreator 1.3.0, Qt 4.6 (2009.05). There are two projects: project A - dynamic library with just one Qt subclass, project B - executable using project A as dependency.
    I've specified project A as a dependency for project B in "Projects" tab in QtCreator.
    • Now when I press build project, everything seems fine, project A compiles first, then project B is compiled and... throws an error where I'm including headers from project A.
    • Simple problem at a glance, so I've just added "INCLUDEPATH += path\to\A" to project B's *.pro file. Now both project are compiled fine, but linking fails due to unresolved symbols, which means that compiler does not know where to look for *.a files (since I'm using mingw)
    • And that's where headache starts. After some searching, I found that I should add "LIBS += path\to\lib.a" directive to project file. That is what I have done. And voila! Everything is working as it seems it should... BUT if I try to compile project B in release mode, it actually links in debug version of project A, since path to the lib file is hardcoded! That's definitely not what I would want. So now every time I switch configuration I have to manually edit project file.

    The question is - is there any way to automate this task, or maybe even more elegant solution for managing dependencies than editing project file by hand?

    P.S. I also noticed that there are two Makefiles generated by qmake - Makefile.Release and Makefile.Debug. They both contain almost the same parameters, except for some optimization and linker flags. Is it the way it should be that qmake generates separate makefiles based on ONE project file? But what if I want (as I described before) to use different parameters (maybe even different source files) for different configurations of ONE project (so don't propose using separate project files)? That seems confusing to me. Well, at least confusing concerning QtCreator; maybe qmake itself allows such things.
    Last edited by nateriver; 22nd December 2009 at 15:45.

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.