Replace -fPIC with POSITION_INDEPENDENT_CODE.#2383
Conversation
|
One wonders whether PIC is needed at all... CMake already defaults on PIC for shared libraries. https://cmake.org/cmake/help/v4.1/prop_tgt/POSITION_INDEPENDENT_CODE.html |
|
Could be PIC for static lib right? Whatever .a that got linked into .so in downstream needs to be built with PIC. |
|
But if you need PIC in the static library, why won't you set CMAKE_POSITION_INDEPENDENT_CODE? |
|
I don't know why this line is there in the first place. |
|
This PR is only to make it "less wrong". |
|
I'll merge because you are improving things. I'll open an issue. |
|
Running tests first. |
|
Although I do want to point out it is not always possible to set a single CMAKE_POSITION_INDEPENDENT_CODE globally, because that can also affect other sub-project built in that run. |
CMake has cross-platform support for
-fPIC