Create object (.o) files in the same folder as source



  • In the project I'm actually trying to compile, there's a physical folder structure like this one:

    abc.c
    misc.c
    xyz.c
    tools\misc.c

    As you can see, there are two files called misc.c, but they are in different folders, then it shouldn't be a problem really.

    However, at objects creation, the compile creates both misc.o in the same folder (release).The problem lies in the fact the first misc.o (source dir\misc.c) is replaced by the second misc.o (source dir\tools\misc.c).

    The project is actually quite complex, in a way there's more than one file in the same situation, then what I need is a way to instruct Qmake to create the .o files in the same folder as their sources (Foe me, it should happen by default).That way, I would have the misc.o files created in their corresponding folders:

    source dir\release\misc.o

    and

    source dir\release\tools\misc.o

    Is there a way to do this on Qmake without having to rename the original files one by one?

    Best regards


  • Moderators

    Not exactly what you want, but you might go for qmake subdirs template (check out Qt sources to get an idea of what it is about). I think this would solve your problem (but will also require some work in redesigning qmake projects).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.