1
0
Fork 0

Link external_mallocng with --whole-archive.

This commit is contained in:
John Preston 2021-05-19 10:22:35 +04:00
parent de65519132
commit 45be9e3215

View file

@ -4,13 +4,15 @@
# For license and copyright information please follow this link: # For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(external_mallocng STATIC) add_library(external_mallocng INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_mallocng ALIAS external_mallocng) add_library(desktop-app::external_mallocng ALIAS external_mallocng)
init_target(external_mallocng "(external)")
add_library(external_mallocng_bundled STATIC)
init_target(external_mallocng_bundled "(external)")
set(mallocng_loc ${third_party_loc}/mallocng) set(mallocng_loc ${third_party_loc}/mallocng)
nice_target_sources(external_mallocng ${mallocng_loc} nice_target_sources(external_mallocng_bundled ${mallocng_loc}
PRIVATE PRIVATE
malloc.c malloc.c
calloc.c calloc.c
@ -24,18 +26,25 @@ PRIVATE
glue.h glue.h
) )
target_compile_options(external_mallocng target_compile_options(external_mallocng_bundled
PRIVATE PRIVATE
-Wno-unused-value -Wno-unused-value
) )
target_include_directories(external_mallocng target_include_directories(external_mallocng_bundled
PRIVATE PRIVATE
${mallocng_loc} ${mallocng_loc}
) )
target_link_libraries(external_mallocng
INTERFACE
-Wl,--whole-archive
external_mallocng_bundled
-Wl,--no-whole-archive
)
target_compile_options(external_mallocng target_compile_options(external_mallocng
PUBLIC INTERFACE
-fno-builtin-malloc -fno-builtin-malloc
-fno-builtin-calloc -fno-builtin-calloc
-fno-builtin-realloc -fno-builtin-realloc