mac build fix

fixes build error for macs, moves mac linker flag to top of cmake file to set the flag for all compiled libraries in the build

this should fix the mac CI build issue due to linking problems (i.e., the current one).