Reputation: 6624
I have a Qt project:
TEMPLATE = lib
CONFIG += plugin static
QT += widgets
INCLUDEPATH += ../../app
HEADERS = basictoolsplugin.h
SOURCES = basictoolsplugin.cpp
TARGET = $$qtLibraryTarget(pnp_basictools)
DESTDIR = ../../plugins
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this!
uikit: CONFIG += debug_and_release
Instead of building a directory one level up from the sources folder, it just puts the build-basictools-Desktop_Qt_5_8_0_GCC_64bit-Debug into the sources folder. Why is it doing this?
It is also worth noting that I get the following message warning after a build:
:-1: warning: The build directory needs to be at the same level as the source directory.
The project below builds as expected, and places its build-extrafilters-Desktop_Qt_5_8_0_GCC_64bit-Debug one level up from the souces folder:
TEMPLATE = lib
CONFIG += plugin
QT += widgets
INCLUDEPATH += ../../app
HEADERS = extrafiltersplugin.h
SOURCES = extrafiltersplugin.cpp
TARGET = $$qtLibraryTarget(pnp_extrafilters)
DESTDIR = ../../plugins
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this!
uikit: CONFIG += debug_and_release
How can I make the first project work as the second project?
UPDATE
Kali Linux
Qt Creator 4.2.1 Based on Qt 5.8.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
Built on Jan 20 2017 01:20:15
Upvotes: 2
Views: 2591
Reputation: 29966
You can set up the build directory in QtCreator by going into "Projects" (the button with a wrench on the left pane), and selecting "Build" for your configuration. There will be a "Build directory" field right on top of the page. In your case you should probably check/uncheck the "shadow build" checkbox for one of the projects.
Now, talking about that warning, in fact qmake doesn't really care where exactly your build directory is, and your project should build just fine. Apparently there has been some sort of a bug which led to that warning introduction (you can check here for a reference). I don't know if it is still relevant, but personally I have never had any trouble building a project with that warning on.
Upvotes: 1