Automatic Copy of Dependent Files in Qt Creator

后端 未结 4 1205
南旧
南旧 2020-12-14 10:48

I\'ve build a program using Qt Creator 2.2.1 and Qt 4.7.4 (32 bit) whose output is an executable. Opening the exe using DependencyWalker it shows that the exe uses following

4条回答
  •  伪装坚强ぢ
    2020-12-14 11:15

    I would modify your *.pro file for the project and use INSTALLS. To actually cause the files to be moved, you will need to run make install. In Qt Creator, you can add it as part of your normal build process by going into the "Projects" section and adding a new build step.

    ## This sets MY_LIB_FILES the libs you want and should also correctly resolve
    ## the location of the libs.
    
    win32 {                ## For Windows builds
        # Note: Check to make sure of file name case
    
        MY_LIB_FILES += $$QMAKE_LIBDIR_QT/MINGWM10.DLL
        MY_LIB_FILES += $$QMAKE_LIBDIR_QT/LIBGCC_S_DW2-1.DLL
        MY_LIB_FILES += $$QMAKE_LIBDIR_QT/QTCORE4.DLL
        MY_LIB_FILES += $$QMAKE_LIBDIR_QT/QTGUI4.DLL
    }
    
    unix {                     ## For unix builds
        # MY_LIB_FILES += $$QMAKE_LIBDIR_QT/...xxxxxx....
    }
    
    ## Define what files are 'extra_libs' and where to put them
    extra_libs.files = MY_LIB_FILES
    extra_libs.path = $$DESTDIR
    
    ## Tell qmake to add the moving of them to the 'install' target
    INSTALLS += extra_libs
    

提交回复
热议问题