1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

compile with -fPIC and bump cmake version

This couldn't be cherry-picked because but essentially the same change
from the ros2 branch here:
d8d160678a

Fixes this error:

```
/usr/bin/ld: /home/alex/ros/h/robotiq/install/serial/lib/libserial.a(serial.cc.o): relocation R_X86_64_PC32 against symbol `_ZTVN6serial6SerialE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
```

Signed-off-by: Alex Moriarty <alex.moriarty@picknik.ai>
This commit is contained in:
Alex Moriarty 2023-06-14 11:18:01 -03:00
parent 30259398ae
commit 380c4e4117

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3) cmake_minimum_required(VERSION 2.8.12)
project(serial) project(serial)
if(APPLE) if(APPLE)
@ -28,6 +28,9 @@ endif()
## Add serial library ## Add serial library
add_library(${PROJECT_NAME} ${serial_SRCS}) add_library(${PROJECT_NAME} ${serial_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ON)
if(APPLE) if(APPLE)
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY}) target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX) elseif(UNIX)