qmake does not generate 2nd install target in Makefile



  • Modified .pro file to install my custom Qt Designer plugin to Creator directory as well:

    CONFIG      += plugin debug_and_release
    TARGET      = $$qtLibraryTarget(WidgetBoxPlugin)
    TEMPLATE    = lib
    ...
    target.path = $$[QT_INSTALL_PLUGINS]/designer
    creator_target.path = $$[QTCREATOR_BIN_PATH]/plugins/designer
    INSTALLS    += target creator_target
    
    

    And resulted dll file was copied into 2 paths (targets). Now it does not work for some reason: qmake does not generate install (copy) script for 2nd target (QTCREATOR_BIN_PATH is set). Think it is a bug in qmake or Qt Creator (QTCREATOR_BIN_PATH is set but not passed to qmake).

    Full project: https://github.com/akontsevich/WidgetBox

    Tried to modify .pro file like mentioned here: http://blog.qt.io/blog/2008/04/16/the-power-of-qmake/ and suggested there: https://bugreports.qt.io/browse/QTBUG-52580

    Modified .pro file to following:

    target.path = $$[QT_INSTALL_PLUGINS]/designer
    
    creator_target.name = Copying the target dll to Qt Creator plugins directory as well
    creator_target.input = $$qtLibraryTarget(WidgetBoxPlugin)
    creator_target.path  = $$[QTCREATOR_BIN_PATH]/plugins/designer
    creator_target.CONFIG += no_check_exist
    creator_target.output = WidgetBoxPlugin.dll
    creator_target.files =  $$[BUILDDIR]/WidgetBoxPlugin.dll
    QMAKE_EXTRA_COMPILERS += creator_target
    
    INSTALLS += target creator_target
    
    

    Build output:

    copy /y \WidgetBoxPlugin.dll \plugins\designer
    Can't find specified file.
    

    Think it is Qt Creator bug 3.6.1 - worked fine in previous versions. I see QTCREATOR_BIN_PATH variable is set, why it is not passed to qmake environment? Same for BUILDDIR


  • Lifetime Qt Champion

    Hi,

    To retrieve environment variables, you need to use parenthesis not square brackets.

    The square brackets are for properties set when Qt was built.



  • This post is deleted!


  • @SGaist works for QTCREATOR_BIN_PATH macro, thanks. Why square brackets works for target?

    According to documentation (https://wiki.qt.io/QMake-top-level-srcdir-and-builddir) correct build dir macro is $$OUT_PWD, so correct installation code is:

    target.path = $$[QT_INSTALL_PLUGINS]/designer
    
    creator_target.name = Copying the target dll to Qt Creator plugins directory as well
    creator_target.input = $qtLbraryTarget(WidgetBoxPlugin)
    creator_target.path  = $$(QTCREATOR_BIN_PATH)/plugins/designer
    creator_target.CONFIG += no_check_exist
    creator_target.output = WidgetBoxPlugin.dll
    creator_target.files = $$OUT_PWD/release/WidgetBoxPlugin.dll
    QMAKE_EXTRA_COMPILERS += creator_target
    
    INSTALLS += target creator_target
    

    This works, thanks! Mark this as resolved!

    P.S. Why engine of this forum sometimes eats 2nd dollar char $$?!


  • Lifetime Qt Champion

    Because QT_INSTALL_PLUGINS is defined at build time and is known to qmake.

    As for the double $ problem, that's rather a question for the NodeBB folks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.