[llvm] [cmake] Include GNUInstallDirs before using variables defined by it. (PR #83807)
Vassil Vassilev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 05:08:07 PDT 2024
https://github.com/vgvassilev updated https://github.com/llvm/llvm-project/pull/83807
>From eed7166e1f7e272af95117fd96f49e7994cef857 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <v.g.vassilev at gmail.com>
Date: Mon, 4 Mar 2024 09:21:43 +0000
Subject: [PATCH] [cmake] Include GNUInstallDirs before using variables defined
by it.
This fixes an odd problem with the regex when `CMAKE_INSTALL_LIBDIR` is not
defined:
`string sub-command REGEX, mode REPLACE: regex "$" matched an empty string.`
Fixes llvm/llvm-project#83802
---
llvm/cmake/modules/Findzstd.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/cmake/modules/Findzstd.cmake b/llvm/cmake/modules/Findzstd.cmake
index 178d99565f044..650f053e84ffd 100644
--- a/llvm/cmake/modules/Findzstd.cmake
+++ b/llvm/cmake/modules/Findzstd.cmake
@@ -34,6 +34,7 @@ if(zstd_FOUND)
elseif (NOT TARGET zstd::libzstd_shared)
add_library(zstd::libzstd_shared SHARED IMPORTED)
if(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)
string(REGEX REPLACE "${CMAKE_INSTALL_LIBDIR}$" "${CMAKE_INSTALL_BINDIR}" zstd_DIRNAME "${zstd_DIRNAME}")
More information about the llvm-commits
mailing list