On 18/06/2012 23:09, Michael Jackson wrote:
Linux really wants to have -fPIC for some of my code and I am trying to detect 
linux and then add this flag for my project but I am having no luck.

if (LINUX)
        set(CMAKE_CXX_FLAGS ${CMAKE_CSS_FLAGS} "-fPIC")
endif()

Is this NOT the way I should be doing this?

You probably meant

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

Also, -fPIC should already be added when building shared libraries or modules.

Maybe you should build your code as a shared library rather than a static one.

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to