[llvm-branch-commits] [llvm] release/19.x: [cmake] Include GNUInstallDirs before using variables defined by it. (#83807) (PR #121410)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 31 10:51:06 PST 2024
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/121410
Backport 5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb
Requested by: @mgorny
>From 27df56d7de461e4fbd04e656cdec98b504eff558 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <v.g.vassilev at gmail.com>
Date: Thu, 22 Aug 2024 13:04:33 +0200
Subject: [PATCH] [cmake] Include GNUInstallDirs before using variables defined
by it. (#83807)
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
(cherry picked from commit 5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb)
---
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 4bc0b793e51c9aa..86b6d48b6ec6b6b 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)
if(NOT "${CMAKE_INSTALL_LIBDIR}" STREQUAL "" AND NOT "${CMAKE_INSTALL_BINDIR}" STREQUAL "")
More information about the llvm-branch-commits
mailing list