Lars Nordlund wrote:
This simple CMakeLists.txt will (on NetBSD at least) cause the binary
'bar' to be linked with -fPIC. Is this really necessary? I know that it
must be used when producing the shared object 'foo', but I did not know
it was needed for the executable also? I have checked the flags passed
from gcc to the linker during the linking of the executable but can not
see that -fPIC makes any difference.

If any of the libraries to which the executable links are shared then -fPIC must be used in the link. It isn't absolutely necessary on all platforms but the same code generates the rules for other platforms too. Is it breaking something for you?

-Brad
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to