How to copy Qt runtime DLLs to project output

后端 未结 4 1297
生来不讨喜
生来不讨喜 2021-02-01 15:46

I have a simple project created in Qt Creator (installed using Qt SDK 1.1.4). It runs just fine from within Qt Creator, but if I then browse to the output directory in Windows

4条回答
  •  清歌不尽
    2021-02-01 16:16

    A bit cleaner method, but it will require doing a make install after a make. It will work on Windows, but would need tweaking for other platforms.

    debug { DESTDIR = debug }
    release { DESTDIR = release }
    debug_and_release { DESTDIR = bin }
    
    myqtlibs.path = $$DESTDIR
    myqtlibs.files = $$QMAKE_LIBDIR_QT/*.dll junk.txt fred.out
    myqtlibs.CONFIG = no_check_exist
    
    INSTALLS += myqtlibs
    

    If qmake is run just for debug, all output will go into ./debug . If it is just for release, all output goes in ./release . If both, then into ./bin .

    I did notice that enabling shadow building in QtCreator caused the executable not to end up in the DESTDIR. I'm not quite sure why.

提交回复
热议问题