CMake 3.19 Xcode generator automatically links libraries
If add_executable lists dylibs as source files, CMake 3.19 seems to automatically add them to the list of libraries to link with the Xcode generator. Their locations are not added to the linker search path, which generally results in linker errors. Anyway, in our case, the dylibs are not listed as source files to link them, but to copy them to the application bundle, because they are Qt plugins.
This basically looks like this:
set(BUSH_PLUGIN_COCOA "${SIMROBOT_PREFIX}/Util/qt/macOS/plugins/platforms/libqcocoa.dylib")
set(BUSH_PLUGIN_MACSTYLE "${SIMROBOT_PREFIX}/Util/qt/macOS/plugins/styles/libqmacstyle.dylib")
set_source_files_properties(${BUSH_PLUGIN_COCOA} PROPERTIES MACOSX_PACKAGE_LOCATION PlugIns/platforms)
set_source_files_properties(${BUSH_PLUGIN_MACSTYLE} PROPERTIES MACOSX_PACKAGE_LOCATION PlugIns/styles)
add_executable(bush MACOSX_BUNDLE ${BUSH_SOURCES} ${BUSH_PLUGIN_COCOA} ${BUSH_PLUGIN_MACSTYLE})
This results in a built error that -lqcocoa
could not be found, which should not be linked at all.
The error seems to be independent of which of the two Xcode build systems is used. However, everything still worked fine with CMake 3.18.