views:

93

answers:

1

I have a Qt project that uses qmake. To improve clarity and readability, I'd like to keep the

  • source files
  • build system
  • generated files (such as object files)

separate.

So my first step was putting the source files into a src/ sub directory:

myproject/
    myproject.pro
    src/
        main.cpp
        MainWindow.ui
        ...

That way I separated the source files from the build system (*.pro). However, when I then run qmake followed by make, the generated files (object files, etc) are placed into the main project folder:

myproject/
    myproject.pro
    Makefile
    main.o
    ui_MainWindow.h
    ...
    src/
        main.cpp
        MainWindow.ui
        ...

Well, at least they weren't put into the src/ folder, but how do I specify that they are put into another sub folder such as build/?

myproject/
    myproject.pro
    Makefile
    build/
        main.o
        ui_MainWindow.h
        ...
    src/
        main.cpp
        MainWindow.ui
        ...

(BTW, I don't care where the target binary myproject is put, but I guess it should be placed directly into project folder rather than into build/.)

+2  A: 

Have a look here :)

mosg
Thanks a lot! I didn't find that during my initial search.
vog
You are welcome!
mosg
Frank
@Frank This solution looks pretty in case, if project OS is `*nix` systems, because, filenames and folders with `.fileName` name view did not shown (they are hidden files). But on windows it's to looks clear... How manage Qt Creator generated files while building process goes, I really don't know...
mosg