Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to make any file the target of a pro file?



  • I am invoking autotools (autogen.sh, configure, make) to build a third party library. This works just fine but now I want the path to the built library to become the target of my pro file. That is, I want qmake to treat is as the file produced by the pro file, copy it to the output folder after being built and remove it if I invoke make clean. Is that possible?



  • I ended up doing it manually. Not as elegant as a theoretical PROVIDES = $${OBJECTS_DIR}/src/.libs/libwolfssl.a but it will do for now.

    TEMPLATE = aux
    
    autoreconf.target = $${PATH}/configure
    autoreconf.commands = cd $${PATH} ; autoreconf -fi
    autoreconf.depends =
    
    # Configure
    OPTS = --prefix=$${DESTDIR}
    
    configure.target = $${OBJECTS_DIR}/Makefile
    configure.commands = cd $${OBJECTS_DIR} ; $${PATH}/configure $${OPTS}
    configure.depends = autoreconf
    
    build.target = $${OBJECTS_DIR}/src/.libs/libwolfssl.a
    build.commands = cd $${OBJECTS_DIR} ; make
    build.depends = configure
    
    install.target = $${DESTDIR}/lib/libwolfssl.a
    install.commands = cd $${OBJECTS_DIR} ; make install
    install.depends = build
    
    uninstall.commands = cd $${OBJECTS_DIR} ; make uninstall ; $${QMAKE_DEL_FILE} Makefile
    clean.depends += uninstall
    
    QMAKE_EXTRA_TARGETS += autoreconf configure build install uninstall clean
    PRE_TARGETDEPS += $${DESTDIR}/lib/libwolfssl.a
    

  • Moderators

    Not entirely sure if it's possible, but maybe this document will help https://doc.qt.io/qt-5/qmake-advanced-usage.html#installing-files



  • I ended up doing it manually. Not as elegant as a theoretical PROVIDES = $${OBJECTS_DIR}/src/.libs/libwolfssl.a but it will do for now.

    TEMPLATE = aux
    
    autoreconf.target = $${PATH}/configure
    autoreconf.commands = cd $${PATH} ; autoreconf -fi
    autoreconf.depends =
    
    # Configure
    OPTS = --prefix=$${DESTDIR}
    
    configure.target = $${OBJECTS_DIR}/Makefile
    configure.commands = cd $${OBJECTS_DIR} ; $${PATH}/configure $${OPTS}
    configure.depends = autoreconf
    
    build.target = $${OBJECTS_DIR}/src/.libs/libwolfssl.a
    build.commands = cd $${OBJECTS_DIR} ; make
    build.depends = configure
    
    install.target = $${DESTDIR}/lib/libwolfssl.a
    install.commands = cd $${OBJECTS_DIR} ; make install
    install.depends = build
    
    uninstall.commands = cd $${OBJECTS_DIR} ; make uninstall ; $${QMAKE_DEL_FILE} Makefile
    clean.depends += uninstall
    
    QMAKE_EXTRA_TARGETS += autoreconf configure build install uninstall clean
    PRE_TARGETDEPS += $${DESTDIR}/lib/libwolfssl.a
    


  • @Marco-Nilsson if you consider your issue solved, please don't forget to mark your post as such. Thanks.


Log in to reply