Thank you for your suggestion, which helped me discover the solution through a few quirks:
I change qmake_example.pro to:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
and start from a clean directory:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
Then:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
To copy to clipboard, switch view to plain text mode
First surprise: in addition to the expected build/debug and build/release, qmake also created directories ./debug and ./release.
Then:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
To copy to clipboard, switch view to plain text mode
Second surprise: the executable binaries did go to build/debug and build/release, but the object files went to ./debug and ./release!
New experiment, this time specifying OBJECTS_DIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
Starting from a clean state:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
qmake still creates directories build/debug, build/release, ./debug, and ./release:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
To copy to clipboard, switch view to plain text mode
but this time at least the object files go to their correct directories:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
To copy to clipboard, switch view to plain text mode
Only remaining problem: two useless-but-still-created-by-qmake directories, ./debug and ./release.
But now, eliminating the intermediate directory ./build in DESTDIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
solves the problem:
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
To copy to clipboard, switch view to plain text mode
The executable binary files and the object files finally go to their intended directories, and no extra directories are created.
Thank you again for pointing me in the right direction. That kind of experience, however, makes me doubt about qmake's quality.
Thank you for your suggestion, which helped me discover the solution through a few quirks:
I change qmake_example.pro to:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
and start from a clean directory:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
Then:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
To copy to clipboard, switch view to plain text mode
First surprise: in addition to the expected build/debug and build/release, qmake also created directories ./debug and ./release.
Then:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
To copy to clipboard, switch view to plain text mode
Second surprise: the executable binaries did go to build/debug and build/release, but the object files went to ./debug and ./release!
New experiment, this time specifying OBJECTS_DIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
Starting from a clean state:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
qmake still creates directories build/debug, build/release, ./debug, and ./release:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
To copy to clipboard, switch view to plain text mode
but this time at least the object files go to their correct directories:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
To copy to clipboard, switch view to plain text mode
Only remaining problem: two useless-but-still-created-by-qmake directories, ./debug and ./release.
But now, eliminating the intermediate directory ./build in DESTDIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
solves the problem:
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
To copy to clipboard, switch view to plain text mode
The executable binary files and the object files finally go to their intended directories, and no extra directories are created.
Thank you again for pointing me in the right direction. That kind of experience, however, makes me doubt about qmake's quality.
Thank you for your suggestion, which helped me discover the solution through a few quirks:
I change qmake_example.pro to:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
and start from a clean directory:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
Then:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ ls build/
debug release
To copy to clipboard, switch view to plain text mode
First surprise: in addition to the expected build/debug and build/release, qmake also created directories ./debug and ./release.
Then:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
qmake_example
$ ls build/release/
qmake_example
$ ls debug/
main.o
$ ls release/
main.o
To copy to clipboard, switch view to plain text mode
Second surprise: the executable binaries did go to build/debug and build/release, but the object files went to ./debug and ./release!
New experiment, this time specifying OBJECTS_DIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = build/debug
} else {
DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
Starting from a clean state:
$ ls
main.cpp qmake_example.pro
$ ls
main.cpp qmake_example.pro
To copy to clipboard, switch view to plain text mode
qmake still creates directories build/debug, build/release, ./debug, and ./release:
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
$ qmake
$ ls
build main.cpp Makefile.Debug qmake_example.pro
debug Makefile Makefile.Release release
To copy to clipboard, switch view to plain text mode
but this time at least the object files go to their correct directories:
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls build/debug/
main.o qmake_example
$ ls build/release/
main.o qmake_example
$ ls debug/
$ ls release/
To copy to clipboard, switch view to plain text mode
Only remaining problem: two useless-but-still-created-by-qmake directories, ./debug and ./release.
But now, eliminating the intermediate directory ./build in DESTDIR:
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
$ cat qmake_example.pro
CONFIG += debug_and_release
CONFIG(debug, debug|release) {
DESTDIR = debug
} else {
DESTDIR = release
}
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
solves the problem:
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
$ ls
main.cpp qmake_example.pro
$ qmake
$ ls
debug Makefile Makefile.Release release
main.cpp Makefile.Debug qmake_example.pro
$ make debug release
<g++'s output lines, no warnings, no errors>
$ ls debug/
main.o qmake_example
$ ls release/
main.o qmake_example
To copy to clipboard, switch view to plain text mode
The executable binary files and the object files finally go to their intended directories, and no extra directories are created.
Thank you again for pointing me in the right direction. That kind of experience, however, makes me doubt about qmake's quality.
Added after 52 minutes:
Latest news:
The example I posted was minimalistic. Our real project also generates moc_*.cpp files and ui_*.h files.
We just discovered that the moc_*.cpp files are generated in their correct directory (debug or release), but the ui_*.h files are generated in the top-level directory (where the source code resides).
Fortunately, adding this directive to our .pro file:
UI_DIR = $$DESTDIR
UI_DIR = $$DESTDIR
To copy to clipboard, switch view to plain text mode
fixes the problem.
Several words are popping to my mind right now to describe qmake, but I am afraid the rules of this forum do not allow me to share my thoughts.
Bookmarks