From f9fec0447e12da9e8cf4b628f6d45f4941e7d182 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 27 Jul 2020 15:36:16 -0700 Subject: [PATCH] [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. --- llvm/lib/Support/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt index 82b7ceb..7b45dc6 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() -- 2.7.4