XCODE_EMBED_FRAMEWORKS does not support dylibs
CMake 3.20 introduced XCODE_EMBED_FRAMEWORKS target property and its documentation at https://cmake.org/cmake/help/v3.20/prop_tgt/XCODE_EMBED_type.html states that "The items can be CMake target names or paths to frameworks or libraries".
But in practice it doesn't work when providing a dylib. It fails at the end of generation step with:
-- Configuring done -- Generating done CMake Error: Can't find a build file for /path/to/lib.dylib CMake Generate step failed. Build files cannot be regenerated correctly.
which is emitted by https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmGlobalXCodeGenerator.cxx#L3870 and reading the code above it looks like only targets or frameworks are actually supported at the moment.
I checked with a project created directly from Xcode and there doesn't look to be any specific limitation with dylibs, so it's only on CMake side.
My build environment: macOS 11.3.1 (Intel) / CMake 3.20.2 / Xcode 12.4