meson: qt5.preprocess target error when using the same file name

So, an invocation like: qrc_files = qt5_mod.preprocess(qresources : 'qml.qrc') In two separate directories reference separate qml.qrc files will fail with: Tried to create target "qml_qrc", but a target of that name already exists.

Example of this are the two directories in https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/qt/

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Hey all, I just encountered this problem while using subprojects. In this case, both projects have a custom target that generates documentation, so naturally both targets are called “docs”. This is super convenient because it means you can type “ninja docs” and have it just work. While I could effectively namespace it to try to make these targets unique (“ninja a-docs”, “ninja b-docs”), this would make the invocations needlessly long and still not guarantee avoidance of namespace collision in all cases.

So this makes me wonder: When preprocessing subprojects, what if we just put each variable into a per-subproject namespace, so that collisions can’t happen anymore? The namespaces can be hidden from the user such that something like this continues to work without breakage:

sp = subproject(‘a’) sp_dep = sp.get_variable(‘some_dep’)

sp.get_variable would automatically look into sp’s namespace when finding ‘some_dep’, but the user would not have to know the difference.

@jpakkane, @nirbheek do you think this sort of solution would be feasible? I haven’t really touched the meson code or internal architecture so I don’t know off-hand.

Without such a fix, AFAICT, the only solution is for my projects to have a longer “docs” generation target, which is inconvenient and eventually will break. In this case, I control the source code for these projects, but if I didn’t, I would have to manually patch the projects to get them to work at all.