[llvm-branch-commits] [llvm] 6b16ce9 - Attempt to fix ZLIB CMake logic on Windows

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 2 02:08:17 PST 2020


Author: Reid Kleckner
Date: 2020-03-02T10:59:51+01:00
New Revision: 6b16ce944fef5f3b30b7dcc001b3af478e038668

URL: https://github.com/llvm/llvm-project/commit/6b16ce944fef5f3b30b7dcc001b3af478e038668
DIFF: https://github.com/llvm/llvm-project/commit/6b16ce944fef5f3b30b7dcc001b3af478e038668.diff

LOG: Attempt to fix ZLIB CMake logic on Windows

CMake doesn't seem to like it when you regex search for "^".

(cherry picked from commit 1079c68aa0fdb14d270a31c0df49a2afc5ed2485)

Added: 
    

Modified: 
    llvm/lib/Support/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index e23f7989e774..5c656164e771 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -198,10 +198,12 @@ if(LLVM_ENABLE_ZLIB)
     get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
   endif()
   get_filename_component(zlib_library ${zlib_library} NAME)
-  if(zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
+  if(CMAKE_STATIC_LIBRARY_PREFIX AND
+     zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
     STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
     STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
-  elseif(zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
+  elseif(CMAKE_SHARED_LIBRARY_PREFIX AND
+         zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
     STRING(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
     STRING(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
   endif()


        


More information about the llvm-branch-commits mailing list