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
20
votes
5 answers

How to compile a simple Qt and c++ application using g++ on mac os x?

I am trying to use Qt for a project in school but am running into problems. I started following the tutorials and I am running into Makefile problems. Most of the tutorials say to run qmake -project, then qmake and finally make. But when I try this…
Sam
  • 864
  • 2
  • 11
  • 21
20
votes
2 answers

QMake: Automatically compiling all files in a directory

For my Qt project, I use a .pro file that includes a separate .pri file for the various header, source, form and resource files. However, every time I add a new file I need to manually add it to the .pri file. This is tedious and error-prone. Is…
Etienne de Martel
  • 34,692
  • 8
  • 91
  • 111
19
votes
3 answers

qmake and QT_INSTALL_PREFIX. How can I select a new location for Qt library?

I am new to qmake and I am trying to build an existing application. Qt was originally installed in /usr/local/lib/Qt-4.3.5 and 'qmake -query QT_INSTALL_PREFIX' returns that path. I have moved the Qt library to another location and the generated…
David Segonds
  • 83,345
  • 10
  • 45
  • 66
19
votes
2 answers

Manually configuring shadow build in qmake

There is a feature I really like in qt creator and it is the Shadow build. When the Shadow Build is on, all the generated files (*.moc, Makefile, *.o) will be generated in a given source directory, so the sources directory is kept clean. I am moving…
Sambatyon
  • 3,316
  • 10
  • 48
  • 65
19
votes
2 answers

How to put generated files (e.g. object files) into a separate folder when using Qt/qmake?

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…
vog
  • 23,517
  • 11
  • 59
  • 75
19
votes
3 answers

Getting values from pro files in Qt

I am using Qt 4.5 in Windows XP. My pro file has the variable VERSION = 1.0. Now i need to read this variable and get its value (1.0) from the source code. So that I don't have to maintain another variable for version inside my source code. I just…
liaK
  • 11,422
  • 11
  • 48
  • 73
18
votes
4 answers

Qmake and passing $ORIGIN to linker option -rpath

I would like to use the -rpath linker option to set the .so search path. I'd like it to search [app_path]/../lib. I've tried add this to my qmake .pro file: QMAKE_LFLAGS += -Wl,-rpath=$ORIGIN/../lib/ But qmake links my project this way: g++…
Vitor Py
  • 5,145
  • 4
  • 39
  • 62
18
votes
2 answers

Adding custom commands to existing targets in qmake

Is there a way to specify, in a .pro file, extra commands to be added to a standard target in the Makefile that qmake generates? For example, consider distclean, extra commands might be desired to: Remove *~ files. Clean out runtime-generated…
Jason C
  • 38,729
  • 14
  • 126
  • 182
18
votes
2 answers

How to set build order in Qt subdir project

I have a project with 5-6 libraries and one executable. The executable depends on the libraries, and some libraries depend on other libraries. How can I specify a build order so the dependencies are built before they are needed?
themean
  • 1,313
  • 4
  • 17
  • 33
17
votes
4 answers

Copy a file to the build directory after compiling project with Qt

I have a file "settings.ini" which needs to reside next to the Qt executable. I can add a custom build step for this in Qt Creator which calls something like this: copy %{sourceDir}/settings.ini %{buildDir}/settings.ini This works great so far, but…
Strayer
  • 3,050
  • 3
  • 30
  • 40
17
votes
4 answers

How to use qmake with two source files which have the same name?

My Qt project have two source files with the same name but in different folder. The pro file is: SOURCES = A/Test.cpp SOURCES += B/Test.cpp It can generate Visual Studio solution file via Qt Visual Studio addon, but it won't work because the…
Bear
  • 1,367
  • 2
  • 13
  • 19
17
votes
1 answer

How to enable sanitizers in QMake?

How do I enable usage of sanitizers in QMake's .pro files? I found several ressources that modify QMAKE_CXXFLAGS themselves but the introductory blogpost says: It is scheduled for the dev branch (Qt 5.2) because it’s a new feature, but you should…
17
votes
4 answers

Running a program/script from QMake

We have a fairly large code-base. The vast majority of the code is compiled using qmake to produce the makefiles. However, there are some sub-projects that get produced by running batch files or running other programs. I'd like to be able to have…
Tom Hennen
  • 4,746
  • 7
  • 34
  • 45
16
votes
1 answer

qmake platform scopes

A standard c++ qmake-based library is developed for Win32, Mac, and Linux. In the qmake project file, the platform-dependent sources are included like this: win32 { SOURCES += WinSystem.cpp HEADERS += WinSystem.h } macx { SOURCES +=…
yolo
  • 2,757
  • 6
  • 36
  • 65
16
votes
2 answers

How to avoid having version numbers in .so file name

I'm trying to build a dynamic library on Linux using qmake. Here is my .pro file: TEMPLATE = lib TARGET = sqxUiBase QT += core gui CONFIG += dll INCLUDEPATH += ../../public/include DEPENDPATH += . UI_DIR += ../GeneratedFiles RCC_DIR +=…
Etienne de Martel
  • 34,692
  • 8
  • 91
  • 111