Describe the bug
Build 1.5.4 with clang-cl/lld-link on Windows with CMake you get this:
11:19:41 lld-link: warning : ignoring unknown argument '-z'
11:19:41 lld-link: error : could not open 'noexecstack': no such file or directory
To Reproduce
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link ..\build\cmake && ninja
Expected behavior
The problem is the check here:
https://github.com/facebook/zstd/blob/dev/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake#L74
This is in the block for Clang, but checks linker flags by calling the compiler. On Windows the compiler is not used as the linker like on Unix systems.
It needs to be a check around this to correctly detect lld-link or re-tool the linker checks to use CMAKE_LINKER instead to perform these checks.
Screenshots and charts
n/a
Desktop (please complete the following information):
- OS: Windows 11
- Compiler: Clang-cl 15.0.7
- Build system: CMake