Libtorch MacOs --no-as-needed not supported

I am trying to compile a pytorch c++ example based on the instruction here: Installing C++ Distributions of PyTorch — PyTorch master documentation

I am running into an issue when i run:

cmake --build . --config Release

I get an error:

[ 50%] Linking CXX executable block_reader
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [block_reader] Error 1
make[1]: *** [CMakeFiles/block_reader.dir/all] Error 2
make: *** [all] Error 2

It looks like the error is that the linker option --no-as-needed is not supported on my os MacOs.

I made sure to download the Max version of libtorch:

I am sure i am not the first person to try this on a Mac…?

I did some searching and it looks like the location in libtorch that support this are:

44:  "One common culprit is a lack of -Wl,--no-as-needed in your link arguments; many "

220:# a dynamic library, it will be pruned unless you are --no-as-needed)
267:          "-Wl,--no-as-needed,\"$<TARGET_FILE:${SRC}>\" -Wl,--as-needed")

76:  INTERFACE_LINK_LIBRARIES "-Wl,--no-as-needed,\"\$<TARGET_FILE:torch_cpu>\" -Wl,--as-needed;\$<TARGET_PROPERTY:torch_cpu,INTERFACE_LINK_LIBRARIES>"
94:  INTERFACE_LINK_LIBRARIES "-Wl,--no-as-needed,\"\$<TARGET_FILE:torch>\" -Wl,--as-needed;\$<TARGET_PROPERTY:torch,INTERFACE_LINK_LIBRARIES>"

any ideas?