cmake/UseGObjectIntrospection.cmake: Fix typelib->gir dependency
Currently, building with parallelism will attempt to generate LomiriAppLaunch-0.gir twice:
- once for the ALL'd gir target, which invokes the gir-generating command to produce the gir file
- once for the ALL'd typelib target, which invokes the typelib-generating command to produce the typelib file, which requires the gir file
add_custom_command
OUTPUT
s must be protected behind an add_custom_target
when multiple targets built in parallel depend on it.
So because the typelib target depends not on the gir target, but just on the file the gir command produces, and both targets are built in parallel, it is invoked twice:
- ALL -> gir target -> gir command
- ALL -> typelib target -> typelib command -> gir command
To fix this, make the typelib target depend on the gir target.
Should fix LomiriAppLaunch-0.gir
appearing twice in the build log:
[ 88%] Generating LomiriAppLaunch-0.gir
[ 89%] Generating LomiriAppLaunch-0.gir
...
[ 91%] Built target gir-LomiriAppLaunch-0.gir
...
[ 92%] Generating LomiriAppLaunch-0.typelib
[ 92%] Built target gir-typelibs-LomiriAppLaunch-0.typelib
Which has caused an issue during the typelib generation at least once (presumably: gir target's gir command executing after typelib target's gir command, while typelib command was trying to use the file, leading to a parse error).