[CMake] Support undefined LLVM_NATIVE_ARCH in llvm_map_components_to_libnames().
authorIvan Kosarev <ivan.kosarev@amd.com>
Thu, 26 Jan 2023 17:44:43 +0000 (17:44 +0000)
committerIvan Kosarev <ivan.kosarev@amd.com>
Thu, 26 Jan 2023 19:37:01 +0000 (19:37 +0000)
https://reviews.llvm.org/D142405 made this function relying on the
LLVM_NATIVE_ARCH be defined, which is not necessarily the case for
third-party projects that include LLVM as their part.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D142610

llvm/cmake/modules/LLVM-Config.cmake

index a5a7be6..37eab12 100644 (file)
@@ -236,7 +236,7 @@ function(llvm_map_components_to_libnames out_libs)
       list(APPEND link_components "interpreter")
     endif()
   endif()
-  if(native IN_LIST link_components AND ${LLVM_NATIVE_ARCH} IN_LIST LLVM_TARGETS_TO_BUILD)
+  if(native IN_LIST link_components AND "${LLVM_NATIVE_ARCH}" IN_LIST LLVM_TARGETS_TO_BUILD)
     list(APPEND link_components ${LLVM_NATIVE_ARCH})
   endif()