Skip to content

Commit 99ee373

Browse files
committed
[core] Strip libCling after build
This is optional during installation, but we always want it because of the large gains, reducing the size of the library further from 105 MB to 88 MB.
1 parent 2fa3ef2 commit 99ee373

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/metacling/src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ if(NOT APPLE AND NOT MSVC)
236236
# After inlining and hiding symbols, some of them are not referenced anymore
237237
# and can be collected by the linker, reducing the library size.
238238
target_link_libraries(Cling PRIVATE -Wl,--gc-sections)
239+
# Additionally, for Release builds, strip the binary to remove symbol tables.
240+
add_custom_command(TARGET Cling POST_BUILD
241+
COMMAND $<$<CONFIG:Release>:${CMAKE_STRIP}>
242+
ARGS $<TARGET_FILE:Cling>)
239243
endif()
240244

241245
if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)

0 commit comments

Comments
 (0)