[llvm] f9fec04 - [llvm] Make ZLIB handling compatible with multi-configuration generators

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 15:37:24 PDT 2020


Author: Jonas Devlieghere
Date: 2020-07-27T15:37:18-07:00
New Revision: f9fec0447e12da9e8cf4b628f6d45f4941e7d182

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

LOG: [llvm] Make ZLIB handling compatible with multi-configuration generators

The CMAKE_BUILD_TYPE is only meaningful to single-configuration
generators (such as make and Ninja). For multi-configuration generators
like Xcode and MSVC this variable won't be set, resulting in a CMake
error.

Added: 
    

Modified: 
    llvm/lib/Support/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 82b7ceb856f2..7b45dc628160 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -200,8 +200,11 @@ add_llvm_component_library(LLVMSupport
 set(llvm_system_libs ${system_libs})
 
 if(LLVM_ENABLE_ZLIB)
-  string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
-  get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
+  # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
+  if(CMAKE_BUILD_TYPE)
+    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
+    get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
+  endif()
   if(NOT zlib_library)
     get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
   endif()


        


More information about the llvm-commits mailing list