Important: Please read the Qt Code of Conduct -

[qmake] custom build tool, how???

  • Hi!
    I need to run custom build tool before compile the project sources.
    I read the documentation and made the folowing changes in my *.pro file:

    @contains(QMAKE_HOST.arch, x86_64) { #x64
    #insert code
    } else {
    ASM_S_STUB_SRC = ./../libffi-3.0.13/src/x86/win32.S
    create_asm_stub.input = ASM_S_STUB_SRC
    create_asm_stub.output = $${OBJECTS_DIR}/${QMAKE_FILE_BASE}.asm
    create_asm_stub.commands = cl.exe /EP /D "X86_WIN32" /I . /I ../includes /I ../libffi-3.0.13/include /I ../libffi-3.0.13/src ${QMAKE_FILE_IN} > $$create_asm_stub.output
    create_asm_stub.CONFIG = no_link

        QMAKE_EXTRA_COMPILERS += create_asm_stub
        PRE_TARGETDEPS += create_asm_stub


    But, when I run project to build I get the following error:
    00:27:00: Starting: "C:\Qt\qtcreator-2.8.0\bin\jom.exe"
    C:\Qt\qtcreator-2.8.0\bin\jom.exe -f Makefile.Debug
    Error: dependent 'create_asm_stub' does not exist.--

    Ok! I'm go to the Make file and find that this rule named as compiler_create_asm_stub_make_all
    Then I change the qmake file
    @PRE_TARGETDEPS += compiler_create_asm_stub_make_all@

    and run build again.
    And at this time it work!

    But I'm not sure that is the correct and right way!
    Please correct me.


Log in to reply