Skip to content

Commit

Permalink
[cmake] Extend zstd.dll finding logic from MSVC to WIN32 in general
Browse files Browse the repository at this point in the history
Extend the special logic for finding `zstd.dll` in `Findzstd` to apply
to all Windows configurations rather than just MSVC.  From what
I understand, this naming scheme is specific to Windows in general,
rather than "Windows with MSVC", and `.lib` files are always used to
link to shared libraries.  I could reproduce the original problem when
using Clang with Conda-installed LLVM, and extending the logic to
`WIN32` seems to fix it for me.

That said, I'm not an expert on Windows and I have only done very
limited testing, so I'd appreciate if someone could double check that
I'm not breaking some workflow.

Fixes llvm#121345
  • Loading branch information
mgorny committed Jan 1, 2025
1 parent ed572f2 commit 003686f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/cmake/modules/Findzstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# zstd::libzstd_shared
# zstd::libzstd_static

if(MSVC)
if(WIN32)
set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
else()
set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
Expand All @@ -33,7 +33,7 @@ if(zstd_FOUND)
set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
elseif (NOT TARGET zstd::libzstd_shared)
add_library(zstd::libzstd_shared SHARED IMPORTED)
if(MSVC)
if(WIN32)
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)
Expand Down

0 comments on commit 003686f

Please sign in to comment.