From 5c03e9dc793610bad6dbb984d1d5a40606288124 Mon Sep 17 00:00:00 2001 From: Anastasios Andronidis Date: Fri, 1 May 2020 17:07:17 +0100 Subject: [PATCH] Compile static and obj targets with PIC --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e37b5083..79a7a577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,6 +199,7 @@ endif() # static library add_library(mimalloc-static STATIC ${mi_sources}) +set_property(TARGET mimalloc-static PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB) target_compile_options(mimalloc-static PRIVATE ${mi_cflags}) target_link_libraries(mimalloc-static PUBLIC ${mi_libraries}) @@ -235,6 +236,7 @@ endif() # single object file for more predictable static overriding add_library(mimalloc-obj OBJECT src/static.c) +set_property(TARGET mimalloc-obj PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(mimalloc-obj PRIVATE ${mi_defines}) target_compile_options(mimalloc-obj PRIVATE ${mi_cflags}) target_include_directories(mimalloc-obj PUBLIC