I'm trying to get qmake to automatically copy the DLLs for my program to the target path, but it's not working. This is the relevant part of my .pro-file:
QT_DIR = C:/Qt/5.1.1/mingw48_32/bin
MY_TARGET_DIR = $$PWD/debug
MY_LIB_FILES += QT_DIR/QT5CORED.DLL
MY_LIB_FILES += QT_DIR/QT5SERIALPORTD.DLL
MY_LIB_FILES += QT_DIR/QT5WIDGETSD.DLL
MY_LIB_FILES += QT_DIR/LIBGCC_S_DW2-1.DLL
MY_LIB_FILES += QT_DIR/LIBWINPTHREAD-1.DLL
MY_LIB_FILES += QT_DIR/LIBSTDC++-6.DLL
MY_LIB_FILES += C:/qwt-6.1.0/lib/QWTD.DLL
extra_libs.files = MY_LIB_FILES
extra_libs.path = MY_TARGET_DIR
INSTALLS += extra_libs
QMake runs normally, but make install issues a warning
Nothing to be done for 'install'.
The DLLs are not copied to the target directory. Also, I tried to write the code more elegantly, but it seems that some QMake variables such as $$QMAKE_LIBDIR are empty. What am I doing wrong?
This is qmake from Qt 5.1.1 .
You need to prepend the QT_DIR
variable with double dollars to make this work:
QT_DIR = C:/Qt/5.1.1/mingw48_32/bin
MY_TARGET_DIR = $${PWD}/debug
MY_LIB_FILES += $${QT_DIR}/QT5CORED.DLL
MY_LIB_FILES += $${QT_DIR}/QT5SERIALPORTD.DLL
MY_LIB_FILES += $${QT_DIR}/QT5WIDGETSD.DLL
MY_LIB_FILES += $${QT_DIR}/LIBGCC_S_DW2-1.DLL
MY_LIB_FILES += $${QT_DIR}/LIBWINPTHREAD-1.DLL
MY_LIB_FILES += $${QT_DIR}/LIBSTDC++-6.DLL
MY_LIB_FILES += C:/qwt-6.1.0/lib/QWTD.DLL
extra_libs.files = MY_LIB_FILES
extra_libs.path = MY_TARGET_DIR
INSTALLS += extra_libs
Side Note: There is a bug in qmake which causes that files containing special characters (like the +
in the name of libstdc++-6.dll
) are not copied during install on Windows. Check my comment in the bug report for a workaround.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.