I use the following linker option on macOS when I know that the symbols will be satisfied at runtime:
-undefined dynamic_lookup
This makes it possible in my project to not link against a specific version of the Python dll, since it is the Python dll loading my library anyway.
This flag depends on whether or not you are using Linux style linking:
-flat_namespace
To make this macOS specific:
IF (APPLE)
SET_TARGET_PROPERTIES(devsim_py3 PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup -flat_namespace")
ENDIF (APPLE)