[cmake] Extend zstd.dll finding logic from MSVC to Clang (#121437) Extend the special logic for finding `zstd.dll` in `Findzstd` to apply to all MSVC-compatible configurations such as Clang targeting MSVC. Fixes #121345 (cherry picked from commit 62d0aff3eb934439acac47348e2385f0751a1444)
diff --git a/llvm/cmake/modules/Findzstd.cmake b/llvm/cmake/modules/Findzstd.cmake index 86b6d48..f6ca5d1 100644 --- a/llvm/cmake/modules/Findzstd.cmake +++ b/llvm/cmake/modules/Findzstd.cmake
@@ -10,7 +10,7 @@ # zstd::libzstd_shared # zstd::libzstd_static -if(MSVC) +if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") else() set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") @@ -33,7 +33,7 @@ set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}") elseif (NOT TARGET zstd::libzstd_shared) add_library(zstd::libzstd_shared SHARED IMPORTED) - if(MSVC) + if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends. # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the "library". get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)