Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QMake: Get full path of output executable

Tags:

qt

qmake

In my .pro file for QMake I would like to run install_name_tool to replace some library paths. For this I need to determine path to my output executable. Particularly on macx the path to executable looks like this

<build_directory>/<configuration_name>/<target_name>.app/Contents/MacOS/<target_name>

I figured out that

message("build_directory=$${OUT_PWD}")
message("target_name=$${TARGET}")

Is there a QMake variable to populate configuration_name?

By default it is supposed to return "release" for release configurations and "debug" for debug configurations. From what I saw online people just explicitly define $${DESTDIR}

debug { DESTDIR = debug }
release { DESTDIR = release }
debug_and_release { DESTDIR = bin }

if not defined message("DESTDIR=$$DESTDIR") returns empty value for DESTDIR.

like image 775
Oleg Zhylin Avatar asked Sep 18 '16 00:09

Oleg Zhylin


1 Answers

This works:

CONFIG(debug, debug|release) {
    DEBUG_OR_RELEASE = debug
}  else {
    DEBUG_OR_RELEASE = release
}

So then the full output path is:

$${OUT_PWD}/$${DEBUG_OR_RELEASE}
like image 108
phyatt Avatar answered Nov 14 '22 21:11

phyatt