diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -692,6 +692,17 @@ endif() function(llvm_get_host_prefixes_and_suffixes) + # Not all platform files will set these variables (relying on them being + # implicitly empty if they're unset), so unset the variables before including + # the platform file, to prevent any values from the target system leaking. + unset(CMAKE_STATIC_LIBRARY_PREFIX) + unset(CMAKE_STATIC_LIBRARY_SUFFIX) + unset(CMAKE_SHARED_LIBRARY_PREFIX) + unset(CMAKE_SHARED_LIBRARY_SUFFIX) + unset(CMAKE_IMPORT_LIBRARY_PREFIX) + unset(CMAKE_IMPORT_LIBRARY_SUFFIX) + unset(CMAKE_EXECUTABLE_SUFFIX) + unset(CMAKE_LINK_LIBRARY_SUFFIX) include(Platform/${CMAKE_HOST_SYSTEM_NAME} OPTIONAL RESULT_VARIABLE _includedFile) if (_includedFile) set(LLVM_HOST_STATIC_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX} PARENT_SCOPE)