Questions tagged [qmake]

`qmake`, part of the Qt framework, is a tool for generating Makefiles and IDE project files.

qmake, part of the Qt framework, is a multi-platform tool for generating GNU Makefiles, Microsoft Visual Studio project files, and Apple XCode project files from a common .pro project file.

Among other features specific to the Qt framework, qmake automates the process of running moc on source files that contain the Q_OBJECT macro.

qmake manual can be found here for Qt 4.8 and here for Qt 5.

1860 questions
54
votes
9 answers

QMake - how to copy a file to the output

How can I copy a file from my project to the output directory with qmake? I'm compiling on Linux but in the future I'll compile it on Mac and Windows.
Raphael
  • 7,972
  • 14
  • 62
  • 83
53
votes
2 answers

qMake: How exactly does qmake interpret the "CONFIG(debug, debug|release)" syntax

I read though HERE, yet I still don't understand the syntax of the qmake CONFIG variable. for example, if I have the following CONFIG settings in my .pro file: CONFIG(debug, debug|release) { message("debug mode") }else { message("release…
hashDefine
  • 1,491
  • 6
  • 23
  • 33
46
votes
5 answers

Qmake project dependencies (linked libraries)

I have a project that links to a number of shared libraries. Lets say project A depends on projects B and C Ideally, I want to impose the following dependencies in my project file: Rebuild project A if either B or C has been rebuilt since last time…
Stick it to THE MAN
  • 5,621
  • 17
  • 77
  • 93
41
votes
3 answers

How to convert qmake to cmake?

I have a .pro file on my project, but now I want to port it to a CMakeLists.txt file. How can I do this? QT += core QT -= gui CONFIG += c++11 TARGET = test CONFIG += console CONFIG -= app_bundle TEMPLATE = app QT += network SOURCES += main.cpp \ …
40
votes
6 answers

Copy a file to build directory after compiling project with Qt

I have seen several suggestions, but nothing really worked for me as I want. I just need to copy a file to the desired destination directory. Say, for example from this answer: install_it.path = %{buildDir} install_it.files +=…
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
36
votes
5 answers

Identifier for win64 configuration in Qmake

Is there a "win64" identifier in Qmake project files? Qt Qmake advanced documentation does not mention other than unix / macx / win32. So far I've tried using: win32:message("using win32") win64:message("using win64") amd64:message("using…
Tuminoid
  • 9,445
  • 7
  • 36
  • 51
35
votes
8 answers

Build Qt in "Release with Debug Info" mode?

Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt. Qt docs has "debug"…
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
35
votes
2 answers

How do I use qmake to build multiple binaries in a single project?

I'm writing a small qt app suite that consists of a set of small programs that work on the same set of files. They are organized like this: / app1/ main.cpp app2/ main.cpp app3/ main.cpp common/ project.h project.cpp …
jrharshath
  • 25,975
  • 33
  • 97
  • 127
34
votes
5 answers

How to copy Qt runtime DLLs to project output

I have a simple project created in Qt Creator (installed using Qt SDK 1.1.4). It runs just fine from within Qt Creator, but if I then browse to the output directory in Windows and double-click the EXE, I'll get an error like: The program can't…
James Johnston
  • 9,264
  • 9
  • 48
  • 76
32
votes
1 answer

Build Qt Project in Debug Mode from Command line (aka bash script) in Linux

I already have a project with a .pro file that can be built in debug and release mode. So my question is what is the options on the commandline that I have to specify if I want to build my binaries with debug information. Here is an example building…
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
32
votes
2 answers

How do I build a static library and executable with Qt?

To simplify the situation, lets say that there are 2 files: core.cpp and main.cpp. core.cpp contains the functionality of the program and main.cpp contains the basic main() implementation. I want Qt (using qmake and the .pro files) to first…
chacham15
  • 13,719
  • 26
  • 104
  • 207
31
votes
5 answers

Linking libraries to a QT project using pkg-config output

This is a bit of a newbie question. I am trying to add the OpenCV libraries to a QT project. This question says the link flags are given by pkg-config --libs opencv If I paste the command line output into the project file like: LIBS +=…
MVG
  • 343
  • 1
  • 3
  • 6
29
votes
2 answers

How to specify Mac platform in qmake (QtCreator)

I would like to set some configurations for Mac OS in pro file via QtCreator. I read the document, and found it supports Windows and Unix, like the following, win32 { SOURCES += hellowin.cpp } unix { SOURCES += hellounix.cpp } I…
CCC
  • 2,164
  • 8
  • 27
  • 47
29
votes
4 answers

qmake pre-build step before ANY compilation

There are several questions on SO regarding how to create a pre-build step for qmake, I can do that with this in my .pro file: versionTarget.target = ../VersionData/versioning.h versionTarget.depends = FORCE win32: versionTarget.commands = cd $$PWD;…
cmannett85
  • 21,725
  • 8
  • 76
  • 119
28
votes
4 answers

How to check the selected version of Qt in a .pro file?

I have multiple versions of Qt installed, and I need to compile my project with all of them. Using a pro file, I could not find in the documentation how to do a conditional compilation. Ideally, this is what I would like to do: QT_VERSION = 5 …
Pietro
  • 12,086
  • 26
  • 100
  • 193