Search code examples
c++qtwindows-1064-bitqmake

Qt - qmake INSTALL only works for debug configuration


When building my project i want to copy the appropriate files of depending on the build, either profile/release or debug.

For now i have the following first approach in my .pro file:

CONFIG(debug, debug|release) {
    OPENCV_PATH = $$OUT_PWD/debug
    OPENCV_DLLS += $$files("$$PWD/../../opencv-build/install/x64/vc15/bin/*d.dll", true)
    LIBS += $$files("$$PWD/../../opencv-build/install/x64/vc15/lib/*d.lib", false)
    message(debug build!)
} else {
    OPENCV_PATH = $$OUT_PWD/release
    OPENCV_DLLS += $$files("$$PWD/../../opencv-build/install/x64/vc15/bin/*.dll", true)
    LIBS += $$files("$$PWD/../../opencv-build/install/x64/vc15/lib/*.lib", false)
    message(release build!)
}

opencv.files += $$OPENCV_DLLS
opencv.path = $$OPENCV_PATH

INSTALLS += opencv

When running qmake or changing the deployment i allways get the correct Project MESSAGE which is debug build! when debug build is set and release build! when release build is set.

But the corresponding dll files only get copied in debug build.

So how can I get Qt to allways copy the corresponding dll files?

Your approach can also include a full distinction between opencv's debug and release dll's since this is the ultimate goal...


Solution

  • I forgot to add the install command as a build step:

    enter image description here

    Now all files get copied.