From 0afc21c9d89f405de5dfbcca59387c245cfbc175 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 15 Feb 2016 10:49:55 +0100 Subject: [PATCH] cmake: fix compilation in lib Need to add -fPIC to objects that will be put in a shared library. --- lib/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a7520f5b..7b012acb 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -25,8 +25,10 @@ set(NGHTTP2_SOURCES ) add_library(nghttp2-obj OBJECT ${NGHTTP2_SOURCES}) +# Needed because the object files are linked into a shared library. +set_target_properties(nghttp2-obj PROPERTIES + POSITION_INDEPENDENT_CODE ON) add_library(nghttp2 SHARED $) -#target_link_libraries(nghttp2 ...) set_target_properties(nghttp2 PROPERTIES COMPILE_FLAGS "${WARNCFLAGS} ${EXTRACFLAG}" VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION})