From 4be5bc8059b2e7b916a80f826ed7fb9b50a36991 Mon Sep 17 00:00:00 2001 From: Masadow Date: Tue, 9 Oct 2018 14:57:44 +0200 Subject: [PATCH] Add support for position independant code compilation --- CMakeLists.txt | 3 +++ Makefile | 1 + 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c40cc15..1ad9700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,9 @@ set(GENERIC_LIB_SOVERSION "6") option(BUILD_SHARED_LIBS "build as shared library" 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_VISIBILITY_INLINES_HIDDEN 1) diff --git a/Makefile b/Makefile index 66b1bc9..5989b95 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ ARFLAGS = cr RM = rm -f RANLIB = ranlib MKDIR = mkdir -p +CXXFLAGS = -fPIC INSTALL = install INSTALL_PROGRAM = $(INSTALL)