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.
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()