Disable PIC for link in CMake

Viewed 2022

I have a C++ project in CMake (32-bit shared library) and gcc compiler. I set POSITION_INDEPENDENT_CODE property to OFF for my project, so it removes -fPIC only for source compiling, but not for link stage too. How can I disable it for link?

I know there is a way with -fno-PIC in LINK_FLAGS. And also also I can set CMAKE_SHARED_LIBRARY_CXX_FLAGS to "". But these ways looks dirty.

0 Answers
Related