Add support for position independant code compilation

This commit is contained in:
Masadow
2018-10-09 14:57:44 +02:00
parent c483646db0
commit 4be5bc8059
2 changed files with 4 additions and 0 deletions

View File

@@ -39,6 +39,9 @@ set(GENERIC_LIB_SOVERSION "6")
option(BUILD_SHARED_LIBS "build as shared library" ON) option(BUILD_SHARED_LIBS "build as shared library" ON)
option(BUILD_TESTS "build xmltest (deprecated: Use BUILD_TESTING)" ON) option(BUILD_TESTS "build xmltest (deprecated: Use BUILD_TESTING)" ON)
# To allow using tinyxml in another shared library
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

View File

@@ -10,6 +10,7 @@ ARFLAGS = cr
RM = rm -f RM = rm -f
RANLIB = ranlib RANLIB = ranlib
MKDIR = mkdir -p MKDIR = mkdir -p
CXXFLAGS = -fPIC
INSTALL = install INSTALL = install
INSTALL_PROGRAM = $(INSTALL) INSTALL_PROGRAM = $(INSTALL)