Navigation Menu

Skip to content

Commit

Permalink
Add Compiler flag -fPIC
Browse files Browse the repository at this point in the history
This fixes an issue on `x86_64` machines where linking to `libaxe.a` would throw
```
relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
```
  • Loading branch information
Simon Cooksey authored and Richard Osborne committed Oct 3, 2014
1 parent 59f99ba commit 230e929
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Expand Up @@ -15,7 +15,7 @@ if(COMPILER_IS_GCC_COMPATIBLE)
check_cxx_compiler_flag("-std=c++11" SUPPORTS_CXX11)
if(SUPPORTS_CXX11)
message(STATUS "-std=c++11 is supported.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11")
else()
check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX0X)
if(SUPPORTS_CXX0X)
Expand All @@ -24,8 +24,8 @@ if(COMPILER_IS_GCC_COMPATIBLE)
else()
message(FATAL_ERROR "C++11 is unsupported.")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wno-unused-parameter -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wno-unused-parameter -fPIC")
endif()
elseif(MSVC)
# Disable the following warnings:
Expand Down

0 comments on commit 230e929

Please sign in to comment.