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

QMAKE_EXTRA_TARGETS and QtCreator



  • I'm trying to package up a folder of includes and libs after my static library builds - and I don't want to use the INSTALL system of qmake (for several reasons) - so I created a small edition to my libraries PRO file, based upon documentation surrounding 'adding custom targets' - and I don't seem to be getting anywhere.

    I can see the target is being written by qmake into the Makefiles, but my understanding is that by adding the target via QMAKE_EXTRA_TARGETS would add this as a target to all build targets.

    Is that incorrect?

    Thanks :)

    # On Windows we want static libraries and a folder of includes
    
    win32: {
        package_includes.target = $$PWD/build/Windows/includes
        package_includes.commands = mkdir $$package_includes.target
        package_includes.depends = package_sdk
    
        package_sdk.commands = @echo Packaging the SDK - creating includes directory at $$package_includes.target
    
        QMAKE_EXTRA_TARGETS += package_includes package_sdk
    }
    


  • BTW, I'm working around it for now using:

    QMAKE_POST_LINK += call package_windows.cmd
    

    And just putting packaging logic in there.


  • Lifetime Qt Champion

    Hi @chopper said in QMAKE_EXTRA_TARGETS and QtCreator:

    I can see the target is being written by qmake into the Makefiles, but my understanding is that by adding the target via QMAKE_EXTRA_TARGETS would add this as a target to all build targets.

    My qmake knowledge is still limited, but I guess that these extra targets are not called automatically. You should be able, however, to call make package_sdk after the build and then it should work...



  • @aha_1980 That's what seems to be happening, but that's not the way the examples I've read state it operates.
    It's more flexible to simply script my custom stuff outside of qmake anyhow.

    Thanks


  • Lifetime Qt Champion

    Hi @chopper,

    so if you found your solution, please mark this topic as SOLVED now. Thanks!


Log in to reply