Skip to content

Commit

Permalink
[cmake] Include GNUInstallDirs before using variables defined by it.
Browse files Browse the repository at this point in the history
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 #83802
  • Loading branch information
vgvassilev committed Mar 4, 2024
1 parent 71c2a13 commit f7a0587
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/cmake/modules/Findzstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit f7a0587

Please sign in to comment.