install(TARGETS): Uses llvm-strip incorrectly on Apple platforms
I’m enabling CPACK_STRIP_FILES
on macOS and I have manually built llvm toolchain in the path (same is reproducible with official LLVM build - https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz) and CPack finds llvm-strip
instead of strip
(which can be picked up either at /usr/bin/strip
or in the SDK). As a result, I have the following message when building the a package:
/Users/dybaboki/tmp/clang+llvm-15.0.7-x86_64-apple-darwin21.0/bin/llvm-strip: error: unknown argument '-u'
Note that the build is “successful”, i.e. CPack ignores this error.
Seems that CPack needs to treat llvm-strip differently, i.e. take into account that -u
is not supported. Alternatively llvm-strip
should not be selected as a strip tool, as strip
is always available (as a system tool or in SDK).
Also if stripping has fail, packaging needs to fail (whatever tool is used) rather than ignore it.
The issue was originally reported on Discourse here