PDA

View Full Version : qmake behaviour through project's .pro



vladeck
18th January 2008, 01:14
Hi all,

I have something like this in my .pro file:


TEMPLATE = app
CONFIG += qt warn_on console
QT +=
SOURCES = ../../Main.cpp
HEADERS =
TARGET = v2
INCLUDEPATH =
CONFIG(debug) {
OBJECTS_DIR = ../../../Target/MSVC8/Debug/v2
DESTDIR = ../../../Target/MSVC8/Debug
} else {
OBJECTS_DIR = ../../../Target/MSVC8/Release/v2
DESTDIR = ../../../Target/MSVC8/Release
}
LIBS =

The problem is that I want everything to be built in Target dir... and that works, but I still get two empty dirs (debug and release) in the same dir as .pro file. What to setup, so that these two dirs are not created?

vladeck
18th January 2008, 14:39
I've found that this is being used:


!contains(TEMPLATE, subdirs):!macx-xcode {
addExclusiveBuilds(debug, Debug, release, Release)
}

The code is from debug_and_release.prf script that creates dirs (debug and release), no mather what :)

jpn
18th January 2008, 16:49
It should be like this:


CONFIG(debug, debug|release) {
...
} else {
...
}

vladeck
19th January 2008, 01:19
I tried what you wrote, the dirs are still being created... it is annoying, since i have something like this:

proj/
-----Build/MSVC8/ <-- .pro file, makefiles, ... but i don't want debug and release dirs to be created
-----Ui/ <-- .ui files
-----Resources/ <-- .qrc files, images, ...
...

and Target dir, where I have final build. Any more suggestions?

fullmetalcoder
19th January 2008, 08:47
You can't prevent the creation of directory. Unless maybe if you force one build mode in you pro file (e.g. "CONFIG += release"). Indeed when both mode are enabled, even if "build_all" is not set, makefiles are generated for both and they NEED the dirs to be created or they just fail to proceed...

vladeck
28th February 2008, 20:53
Solution to disable creation of Debug/Release dirs in the same dir as Visual Studio .sln when using hierarchy like this:


Project root/
Build/
MSVC7.1/ <-- Visual Studio 2003
MSVC8/ <-- Visual Studio 2005
Project.pro
GCC/ <-- for GCC
Resources/ <-- .qrc and .png/.jpg/.gif files
Ui/ <-- .ui forms
... <-- code is in root

Project.pro:

TEMPLATE = app
CONFIG += qt warn_on uitools
QT += sql

SOURCES = ../../Main.cpp \
../../TreeItem.cpp \
../../SqlTreeModel.cpp

HEADERS = ../../Main.hpp \
../../TreeItem.hpp \
../../SqlTreeModel.hpp

TARGET = Test
INCLUDEPATH =

QMAKE_CXXFLAGS_DEBUG += /Fd"../../../Target/MSVC8/Debug/Test/vc80.pdb"

CONFIG(debug, debug|release) {
OBJECTS_DIR = ../../../Target/MSVC8/Debug/Test
MOC_DIR = ../../../Target/MSVC8/Debug/Test
RCC_DIR = ../../../Target/MSVC8/Debug/Test
DESTDIR = ../../../Target/MSVC8/Debug
} else {
OBJECTS_DIR = ../../../Target/MSVC8/Release/Test
MOC_DIR = ../../../Target/MSVC8/Release/Test
RCC_DIR = ../../../Target/MSVC8/Release/Test
DESTDIR = ../../../Target/MSVC8/Release
}

LIBS =
RESOURCES = ../../Resources/Test.qrc

This way, you will have your Target dir as the dir where all is built, only Makefiles will be generated in Build/MSVC8...