Skip to content

Commit

Permalink
Enable -fPIC in gcc/clang
Browse files Browse the repository at this point in the history
This is to prevent errors like this one, while linking liboctomath.a against another user shared library:

```
/usr/bin/ld: ../../lib/liboctomath.a(Vector3.cpp.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
../../lib/liboctomath.a: error adding symbols: Bad value
```
  • Loading branch information
jlblancoc authored Aug 13, 2017
1 parent 42b02c0 commit 33bdbb6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
PROJECT( octomap-distribution )

ENABLE_TESTING() # enable CTest environment of subprojects
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # enables -fPIC in applicable compilers (required to avoid link errors in some cases)

option(BUILD_OCTOVIS_SUBPROJECT "Build targets from subproject octovis" ON)
option(BUILD_DYNAMICETD3D_SUBPROJECT "Build targets from subproject dynamicEDT3D" ON)
Expand Down

0 comments on commit 33bdbb6

Please sign in to comment.