qmake install error detection on Windows



  • Hi Guys, I'm facing an annoying deployment problem when using qmake

    Take this example .pro file:

    target.path = C:/temp
    baseLibs.path = C:/temp
    baseLibs.files = "SomeConfigFile.xml"
    
    INSTALLS += baseLibs target
    

    and that the target is MyApp.exe

    Now let's imagine I call nmake install while I have C:/temp/MyApp.exe open. The result is that the target copy will fail but, since the xml file gets copied successfully make terminates with a success (errorlevel is 0).
    Is there any way I can detect that error?
    I already tried inverting the arguments to INSTALLS but it doesn't solve my problem


  • Lifetime Qt Champion

    Hi,

    Since this is going to be a Windows specific issue, did you check the content of the Makefile regarding the install step ?



  • Yes, not much there:

    INSTALL_FILE    = copy /y
    install_target: first FORCE
    	@if not exist $(INSTALL_ROOT)C:\temp mkdir $(INSTALL_ROOT)C:\temp & if not exist $(INSTALL_ROOT)C:\temp exit 1
    	-$(INSTALL_FILE) $(DESTDIR_TARGET) $(INSTALL_ROOT)C:\temp\$(TARGET)
    
    install_baseLibs: first FORCE
    	@if not exist $(INSTALL_ROOT)C:\temp mkdir $(INSTALL_ROOT)C:\temp & if not exist $(INSTALL_ROOT)C:\temp exit 1
    	-$(INSTALL_FILE) SomeConfigFile.xml $(INSTALL_ROOT)C:\temp
    

    Ideal scenario would be that I can check if any of those copy /y failed.


  • Lifetime Qt Champion

    What if you add the /v parameter ?


  • Qt Champions 2017

    Just a wild guess, but what if you add dependency of the one target to the other?
    Something like:

    target.path = C:/temp
    baseLibs.path = C:/temp
    baseLibs.files = "SomeConfigFile.xml"
    
    target.depends = baseLibs
    


  • @kshegunov said in qmake install error detection on Windows:

    target.depends = baseLibs

    This was a very promising idea but unfortunately it looks like .depends does not work with other INSTALLS tagets



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