Re: [CMake] How to add -fPIC to a static library?

2016-08-29 Thread Peter Steinbach
AFAIK, there is also a global CMAKE_POSITION_INDEPENDENT_CODE that is used to derive the target-specific value of POSITION_INDEPENDENT_CODE. If you wanna use fPIC for all your targets, you may wanna consider set(CMAKE_POSITION_INDEPENDENT_CODE ON). Best, P -- Powered by www.kitware.com Please

Re: [CMake] How to add -fPIC to a static library?

2016-08-28 Thread Steve Lorimer
Thanks Nicholas, you are indeed correct! On 28 August 2016 at 17:35, Nicholas Braden wrote: > Have you tried set_property(TARGET cpp-netlib_pic PROPERTY > POSITION_INDEPENDENT_CODE ON)? I think you must specify the value ON > for it to work. > > On Sun, Aug 28, 2016 at 4:28 PM, Steve Lorimer >

Re: [CMake] How to add -fPIC to a static library?

2016-08-28 Thread Nicholas Braden
Have you tried set_property(TARGET cpp-netlib_pic PROPERTY POSITION_INDEPENDENT_CODE ON)? I think you must specify the value ON for it to work. On Sun, Aug 28, 2016 at 4:28 PM, Steve Lorimer wrote: > I'm trying to create a static library with -fPIC specified. > > add_library(cpp-netlib_pic >

[CMake] How to add -fPIC to a static library?

2016-08-28 Thread Steve Lorimer
I'm trying to create a static library with -fPIC specified. add_library(cpp-netlib_pic STATIC ${SRCS}) set_property(TARGET cpp-netlib_pic PROPERTY POSITION_INDEPENDENT_CODE) This doesn't work. The library (cpp-netlib_pic) is built without the -fPIC flags. Other targets which link agains