Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring variable DESTDIR in qmake

Tags:

build

qmake

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?

like image 633
cake Avatar asked Jan 26 '10 16:01

cake


People also ask

What is qmake conf?

qmake. conf as the name suggests (and as the documentation you link says) is a file containing persistent build configuration information for your project. Each toolchain will contain a mkspecs directory with a series of subdirectories for each target that toolchain can build for.

What is .pro file in Qtcreator?

Project files contain all the information required by qmake to build your application, library, or plugin.

What is qmake command?

The qmake tool provides you with a project-oriented system for managing the build process for applications, libraries, and other components. This approach gives you control over the source files used, and allows each of the steps in the process to be described concisely, typically within a single file.


1 Answers

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/
like image 79
Tatu Lahtela Avatar answered Sep 30 '22 01:09

Tatu Lahtela