0

I'm using qmake to build a macOS application, and for my release builds I'm having it run macdeployqt and then codesigning the app as a post link step (using QMAKE_POST_LINK).

However, if there's already an application bundle present in the build directory from a previous build, then running it through macdeployqt again will generate warnings, and sometimes errors, such as when the dependencies of the project have changed. Furthermore, qmake isn't smart enough to detect when files that are included in the app bundle have changed or are no longer required, such as with files copied into its Resources folder.

Consequently I'd like to have qmake delete the application bundle at the start of a build if it exists, but keep the other build artifacts (like object files) so that I don't have to do a full build every time.

So far I've tried using QMAKE_PRE_LINK to delete the app by setting it to rm -rf $${TARGET}.app, but apparently it doesn't wait for the command in this variable to finish executing before assembling the app bundle, so using it to delete a previously built app bundle will cause linking to fail due to files being unexpectedly deleted.

I've also tried the method mentioned in this question but it fails for precisely the same reason -- the target I define will run concurrently with all the others, and it will delete files while qmake is trying to assemble the app bundle.

Is there a way to do this?

Bri Bri
  • 1,676
  • 2
  • 18
  • 36

0 Answers0