Add PIC compile flag for GNU/CLang.

- ensures shared library code is position-independent.
This commit is contained in:
Jiri Hoogland 2015-12-10 10:33:00 -05:00 committed by Jesse Beder
parent b57efe94e7
commit 4376ebacaa

View File

@ -171,6 +171,10 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
#
set(GCC_EXTRA_OPTIONS "")
#
if(BUILD_SHARED_LIBS)
set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} -fPIC")
endif()
#
set(FLAG_TESTED "-Wextra")
check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA)
if(FLAG_WEXTRA)