[libc-commits] [PATCH] D141282: [libc][cmake] Fix LIBC_TARGET_OS query from compiler triple for `darwin`.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jan 27 07:15:09 PST 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa369bb8a3b18: [libc][cmake] Fix LIBC_TARGET_OS query from compiler triple for `darwin`. (authored by lntue).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141282/new/

https://reviews.llvm.org/D141282

Files:
  libc/cmake/modules/LLVMLibCArchitectures.cmake


Index: libc/cmake/modules/LLVMLibCArchitectures.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -46,6 +46,8 @@
   if(target_arch MATCHES "^mips")
     set(target_arch "mips")
   elseif(target_arch MATCHES "^arm")
+    # TODO(lntue): Shall we separate `arm64`?  It is currently recognized as
+    # `arm` here.
     set(target_arch "arm")
   elseif(target_arch MATCHES "^aarch64")
     set(target_arch "aarch64")
@@ -59,6 +61,16 @@
 
   set(${arch_var} ${target_arch} PARENT_SCOPE)
   list(GET triple_comps ${system_index} target_sys)
+
+  # Correcting OS name for Apple's systems.
+  if(target_sys STREQUAL "apple")
+    list(GET triple_comps 2 target_sys)
+  endif()
+  # Strip version from `darwin###`
+  if(target_sys MATCHES "^darwin")
+    set(target_sys "darwin")
+  endif()
+
   set(${sys_var} ${target_sys} PARENT_SCOPE)
 endfunction(get_arch_and_system_from_triple)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141282.492750.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230127/49bf32b1/attachment.bin>


More information about the libc-commits mailing list