mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
cmake: CMAKE_POSITION_INDEPENDENT_CODE
- remove set BUILD_SHARED_LIBS ON
- set CMAKE_POSITION_INDEPENDENT_CODE ON if undefined
When setting BUILD_SHARED_LIBS if user set it to off linking would fail.
Adding the suggetion from pull request review, which seems to work in
both cases
colcon build --cmake-args "-DBUILD_SHARED_LIBS=ON"
colcon build --cmake-args "-DBUILD_SHARED_LIBS=OFF"
Signed-off-by: Alex Moriarty <alex.moriarty@picknik.ai>
This commit is contained in:
parent
40d295030e
commit
48f14ce457
@ -1,8 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.5.0)
|
||||
|
||||
# General setup
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
|
||||
set(PROJ_SOVERSION 1)
|
||||
project(serial
|
||||
VERSION 1.2.1
|
||||
@ -41,12 +39,16 @@ set(serial_HEADERS
|
||||
include/serial/v8stdint.h
|
||||
)
|
||||
# Build, link and install main library
|
||||
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
add_library(${PROJECT_NAME} ${serial_SRCS})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJ_SOVERSION}
|
||||
PUBLIC_HEADER "${serial_HEADERS}"
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user