Skip to content

Commit 7ed5bf9

Browse files
Compile 3rdparty libraries with -fPIC so that final library could be linked staticaly
1 parent 42d5efe commit 7ed5bf9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

3rdparty/CompilerFlags.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ STRING(APPEND CFLAGS " -I${THIRDPARTY_PREFIX}/include")
3333
STRING(APPEND CXXFLAGS " -I${THIRDPARTY_PREFIX}/include")
3434
STRING(APPEND LDFLAGS " -L${THIRDPARTY_PREFIX}/lib")
3535

36+
# Linking shared shared libs against static libs require static libs to have
37+
# Position Independent Code (PIC)
38+
# libpdf2htmlEX.so is a shared lib
39+
STRING(APPEND CFLAGS " -fPIC ")
40+
STRING(APPEND CXXLAGS " -fPIC ")
41+
3642
# march=armv7-a breaks build.
3743
# Both Autotools and Meson fail, telling that compiler does not work
3844
if(CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
3945
STRING(REPLACE "-march=armv7-a" "" CFLAGS "${CFLAGS}")
4046
STRING(REPLACE "-march=armv7-a" "" CXXFLAGS "${CXXFLAGS}")
4147
endif()
48+

0 commit comments

Comments
 (0)