[CMake] swig module add -fPIC flag

CHEVRIER, Marc marc.chevrier at sap.com
Wed Apr 25 10:03:39 EDT 2018


swig modules created with command SWIG_ADD_LIBRARY are "standard" CMake targets so, same approach apply.


>From convenience, you can use command SWIG_LINK_LIBRARIES (same semantic as TARGET_LINK_LIBRARIES) to manage custom link flags.


Now, regarding specifically flag -fPIC you can manage more easily and in a portable way the 'Position Independent Code' generation by setting variable CMAKE_POSITION_INDEPENDENT_CODE=ON. And I think this flag is for the compiler, not the linker...


________________________________
From: CMake <cmake-bounces at cmake.org> on behalf of Stéphane Ancelot <sancelot at numalliance.com>
Sent: Wednesday, April 25, 2018 3:40:45 PM
To: cmake at cmake.org
Subject: [CMake] swig module add -fPIC flag

Hi,

I have not found how to add -fPIC link flag to a SWIG module.

Regards

S.Ancelot

--

Powered by www.kitware.com<http://www.kitware.com>

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180425/9025baaa/attachment-0001.html>


More information about the CMake mailing list