Search code examples
qtazure-devopscmdazure-pipelinesqmake

Cannot use INSTALL_ROOT with qmake on Azure DevOps Pipelines in Windows Agent


I have a Qt (5.15) project that is building with qmake on Azure DevOps Piplelines on a self-hosted Windows Agent.

My build and install step looks as follows...

- script: |
    call C:\"Program Files (x86)"\"Microsoft Visual Studio"\2019\Community\VC\Auxiliary\Build\vcvarsall.bat amd64
    call qmake $(Build.SourcesDirectory)
    call jom
    call jom install
  workingDirectory: $(Build.BinariesDirectory)
  env:
    INSTALL_ROOT: $(Build.ArtifactStagingDirectory)

From my understanding, I must use script as vcvarsall.bat cannot be ran from powershell.

The resulting error is on jom install:

The filename, directory name, or volume label syntax is incorrect.

I have...

  • verified INSTALL_ROOT is set properly with the env step property.
  • tried adding a line to set the environment variable, call set INSTALL_ROOT=$(Build.ArtifactStagingDirectory), in the script step. This doesn't change the error.
  • ran these exact commands on the same agent from cmd.exe and from a .bat file. The package is installed as expected.

How do I get the DevOps Windows agent to complete the install task?


When I remove INSTALL_ROOT environment variable, the install steps succeeds. Obviously, it is not installed in the correct location in this scenario.


Solution

  • It appears that qmake will append C: to the front of the INSTALL_ROOT variable when generating the directives in the Makefile.

    In order to use $(Build.ArtifactStagingDirectory), the drive prefix must be stripped.