How to use qmake shadow build in snapcraft

I am trying to package a https://github.com/mavlink/qgroundcontrol into a snap where it does the “shadow build”

The project file includes the following line.

    exists($${OUT_PWD}/qgroundcontrol.pro) {
        error("You must use shadow build (e.g. mkdir build; cd build; qmake ../qgroundcontrol.pro).")
    }

Therefore, when I run snapcraft which is configured as

  qgroundcontrol:
    plugin: qmake
    qt-version: qt5
    project-files: [qgroundcontrol.pro]
    source: .

The snap directory is placed where the .pro file is located.
As expected, it is caught as a error

Project ERROR: You must use shadow build (e.g. mkdir build; cd build; qmake ../my-part.pro).

The .pro file is located at the . directory.

  1. I tried to see how other projects are dealing with this issue, but couldn’t find any which are trying to use the “shadow build” feature of Qt

  2. I tried moving the .pro files to a seperate directory from source file

Or is this something that the qmake snapcraft plugin cannot currently deal with?

Thank you in advance