Merge pull request #2297 from ben-clayton/fpic

CMake: Compile with -fPIC when building SOs
This commit is contained in:
John Kessenich 2020-06-30 07:55:53 -06:00 committed by GitHub
commit 8f4251a708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,6 +119,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
if(BUILD_SHARED_LIBS)
add_compile_options(-fPIC)
endif()
if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()
@ -135,6 +138,9 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
if(BUILD_SHARED_LIBS)
add_compile_options(-fPIC)
endif()
if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()