install: CMake 3.21 fails to strip with older clang (10-)
To strip with llvm-strip (in version 10 and earlier) you need extra flags (-S
).
This is not something that CMake does. You only get this is cmake_install.cmake
:
if(CMAKE_INSTALL_DO_STRIP)
execute_process(COMMAND "/usr/bin/llvm-strip-10" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/test")
endif()
The biggest problem comes with this addition to CMake 3.21: cf82300a
As far as I understand it this causes llvm-strip
to get priority over strip
.
We can provide examples but the essence here is:
- CMake 3.21+
- clang 10
cmake --build . --target install/strip
llvm-strip-11 or newer seems to work fine.
I would consider this a quite serious bug because it will silently produce unstripped binaries. Just an upgrade of CMake on a CI builder could cause an information leak.