[CMake] Accepted way to add "-fPIC" onto CMAKE_CXX_FLAGS?
Alain Leblanc
aalebl at gmail.com
Mon Jun 18 20:09:22 EDT 2012
Starting to dislike the gmail program.
So here's a corrected message , to the list this time:
=======================================
This is how I've been doing for years. Doesn't mean it's the right way :)
Here -O3 and -DLINUX don't apply to your case, and ${SRC_FILES} has been
assigned with the file() command. Using ${UNIX}, but ${LINUX} would work
as well, maybe.
if (${UNIX})
set (EXTRA_OPTIONS "-O3 -Wno-deprecated -fPIC -DLINUX")
endif (${UNIX})
.
.
.
set_source_files_properties(${SRC_FILES}
PROPERTIES
COMPILE_FLAGS "${EXTRA_OPTIONS}")
On 06/18/2012 05:09 PM, 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? It doesn't really "fell" correct but nothing else (including this) seems to work.
>
> Help?
>
> Thanks
> ___________________________________________________________
> Mike Jackson Principal Software Engineer
> BlueQuartz Software Dayton, Ohio
> mike.jackson at bluequartz.net www.bluequartz.net
>
> --
>
> 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
More information about the CMake
mailing list