IMO, you should identify which targets need what things and then use target_link_libraries to establish the relationships between targets.
It’s a little bit wrinkly because you’re using dependencies from your environment, e.g. -lcurl, instead of a CMake target like curl::curl.
The “modern CMake” way of expressing these relationships is to use find_package to locate your dependencies on the system and then you should have imported targets on which you can express the relationships.
Starting with the first error:
[ 28%] Linking C shared library libsentrypeer.dylib
...
_MHD_add_response_header, referenced from:
_finalise_response in http_common.c.o
_finalise_response in http_common.c.o
_finalise_response in http_common.c.o
_finalise_response in http_common.c.o
Says that http_common.c has a link dependency on MHD_add_response and presumably this symbol is supplied by -lmicrohttpd.
You’re building a shared library – libsentrypeer.dylib – and shared libraries, unlike static libraries, need to resolve all their symbols at link time.
So yes, you need to make your shared library target depend on -lmicrohttpd.
Fix the link errors one at a time, identifying the missing library and adding it until linking succeeds.
Once you’ve got it all linking and comitted, consider using find_package to locate your dependencies and express the relationships with imported alias targets instead of link command-line options.