Set CMake to use dyld options instead GNU ld optio

2019-05-31 08:46发布

问题:

I try to to port a linux software to OS X (Yosemite) which uses CMake to be built. The only modification that I necessarily made, was to direct to the Homebrew installed GNU GCC and G++ when executing cmake.

If I use the already existing CMakeLists.txt, the build process stops with the following error:

ld: unknown option: --start-group
collect2: error: ld returned 1 exit status
make[2]: *** [lib/somelib.dylib] Error 1
make[1]: *** [lib/somelib.dir/all] Error 2
make: *** [all] Error 2

Obviously --start-group is an option only for GNU ld and not dyld, the OS X ld derivate. Installing GNU ld on OS X is not possible, as answered here.

How can set CMake to use dyld options instead?