File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,11 +49,14 @@ else(MSVC)
4949 # Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment
5050 set (STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE )
5151
52- # Strip debug symbols from Release binaries (reduces binary size significantly)
53- # On Windows, debug symbols go to separate .pdb files, so this is not needed
54- # NOTE: CMAKE_BUILD_TYPE must be set to Release for this to take effect
55- # e.g., cmake -B build -DCMAKE_BUILD_TYPE=Release
56- add_link_options ($<$<CONFIG :Release >:-s >)
52+ # Strip symbols from Release binaries. Apple's ld deprecated `-s`;
53+ # `-Wl,-x` is its documented replacement and keeps dynamic exports.
54+ # MSVC has no equivalent — symbols live in the .pdb, not the binary.
55+ if (APPLE )
56+ add_link_options ($<$<CONFIG :Release >:-Wl ,-x >)
57+ else ()
58+ add_link_options ($<$<CONFIG :Release >:-s >)
59+ endif ()
5760
5861 # Dead-code stripping for macOS: Apple's -dead_strip works on Mach-O
5962 # atoms without needing -ffunction-sections/-fdata-sections.
You can’t perform that action at this time.
0 commit comments