[cmake,release] Prevent searching twice for modules.

Before we tried to search for dune-common twice (once without a version
and then with the required version). Unfortunately this breaks because
we are adding the same library target twice. With this patch we only
search for a module once.
(cherry picked from commit b58b8475caa5b6716cdc482b1444692a41391015)

Signed-off-by: Markus Blatt <markus@dr-blatt.de>