[llvm] 5bbd598 - [cmake] Include GNUInstallDirs before using variables defined by it. (#83807)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 04:04:38 PDT 2024


Author: Vassil Vassilev
Date: 2024-08-22T13:04:33+02:00
New Revision: 5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb

URL: https://github.com/llvm/llvm-project/commit/5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb
DIFF: https://github.com/llvm/llvm-project/commit/5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb.diff

LOG: [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

Added: 
    

Modified: 
    llvm/cmake/modules/Findzstd.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/Findzstd.cmake b/llvm/cmake/modules/Findzstd.cmake
index 4bc0b793e51c9a..86b6d48b6ec6b6 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-commits mailing list