[llvm] [cmake] Extend zstd.dll finding logic from MSVC to WIN32 in general (PR #121437)
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 1 07:30:45 PST 2025
https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/121437
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 #121345
>From 003686fd6ae6c3ef026bff3e601010bdd3ad5f36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Wed, 1 Jan 2025 16:25:26 +0100
Subject: [PATCH] [cmake] Extend zstd.dll finding logic from MSVC to WIN32 in
general
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 #121345
---
llvm/cmake/modules/Findzstd.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/cmake/modules/Findzstd.cmake b/llvm/cmake/modules/Findzstd.cmake
index 86b6d48b6ec6b6..6726e9ea940b92 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(WIN32)
set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
else()
set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
@@ -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)
More information about the llvm-commits
mailing list