set POSITION_INDEPENDENT_CODE if BUILD_SHARED_LIBS=OFF (#1076)

This commit is contained in:
Christian Rauch 2022-01-27 23:03:10 +00:00 committed by GitHub
parent f8e1a7be3b
commit cdf89fa352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,6 +80,10 @@ set_property(TARGET yaml-cpp
PROPERTY
CXX_STANDARD_REQUIRED ON)
if (NOT YAML_BUILD_SHARED_LIBS)
set_property(TARGET yaml-cpp PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
target_include_directories(yaml-cpp
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>