Reputation: 1386
I'm using qmake for building a project of mine. I have been trying to set the DESTIR variable of qmake with a value that depend of the compiler used. Actually, I want that the binary of my project, after builded, be placed in a directory that has the name of the compiler used to build it.
Something like this... My current directory tree for my project is
- Project | - src | - include | - bin | |- binary_file
I wanted it to be like this
- Project | - src | - include | - bin | | - gcc-4.3.4 | | |- binary_file
Can I do this using qmake?
Upvotes: 10
Views: 7225
Reputation: 4554
In the src/src.pro file, or wherever you set the DESTDIR
# compiler used
QMAKE_CXX = g++-4.3
# PROJECT_ROOT defined in .qmake.cache as $$PWD, in the Project root directory
DESTDIR = $$PROJECT_ROOT/bin/$$QMAKE_CXX/
If you don't want to set the compiler version, you can query it dynamically. I don't know if there is any general c++/qmake solution for it, but with g++ you can use -dumpversion:
CXX_VERSION = $$system($$QMAKE_CXX -dumpversion)
DESTDIR=$$PROJECT_ROOT/bin/$$QMAKE_CXX-$$CXX_VERSION/
Upvotes: 10