2

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

2
  • Are you using QtCreator? Commented Feb 3, 2017 at 13:05
  • Yes. Qt Creator 4.2.1 Based on Qt 5.8.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit) on Kali Linux Commented Feb 3, 2017 at 13:10

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.