[libc-commits] [libc] [libc][CMake] fix CMake configure issues on openSUSE (PR #79751)

Sirui Mu via libc-commits libc-commits at lists.llvm.org
Sun Jan 28 06:42:02 PST 2024


https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/79751

>From eb6772b25c20a0b8b0252fc2d58eff476c95ff1a Mon Sep 17 00:00:00 2001
From: Sirui Mu <msrlancern at gmail.com>
Date: Sun, 28 Jan 2024 21:39:01 +0800
Subject: [PATCH 1/2] [libc][CMake] fix CMake configure issues on openSUSE

---
 libc/cmake/modules/LLVMLibCArchitectures.cmake | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 10571101a341785..dbd3ea7293b2437 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -171,6 +171,11 @@ elseif(LIBC_TARGET_OS STREQUAL "poky")
   # include the right directories during compilation.
   set(LIBC_TARGET_OS_IS_LINUX TRUE)
   set(LIBC_TARGET_OS "linux")
+elseif(LIBC_TARGET_OS STREQUAL "suse")
+  # openSUSE uses different triple format which causes LIBC_TARGET_OS to be
+  # computed as "suse" instead of "linux".
+  set(LIBC_TARGET_OS_IS_LINUX TRUE)
+  set(LIBC_TARGET_OS "linux")
 elseif(LIBC_TARGET_OS STREQUAL "darwin")
   set(LIBC_TARGET_OS_IS_DARWIN TRUE)
 elseif(LIBC_TARGET_OS STREQUAL "windows")

>From 8d83447828851b8e8e29bedd59923f2bb24493bc Mon Sep 17 00:00:00 2001
From: Sirui Mu <msrlancern at gmail.com>
Date: Sun, 28 Jan 2024 22:10:36 +0800
Subject: [PATCH 2/2] Merge with the poky case

---
 libc/cmake/modules/LLVMLibCArchitectures.cmake | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index dbd3ea7293b2437..623ed774be72704 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -165,13 +165,11 @@ if(LIBC_TARGET_OS STREQUAL "baremetal")
   set(LIBC_TARGET_OS_IS_BAREMETAL TRUE)
 elseif(LIBC_TARGET_OS STREQUAL "linux")
   set(LIBC_TARGET_OS_IS_LINUX TRUE)
-elseif(LIBC_TARGET_OS STREQUAL "poky")
+elseif(LIBC_TARGET_OS STREQUAL "poky" OR LIBC_TARGET_OS STREQUAL "suse")
   # poky are ustom Linux-base systems created by yocto. Since these are Linux
   # images, we change the LIBC_TARGET_OS to linux. This define is used to
   # include the right directories during compilation.
-  set(LIBC_TARGET_OS_IS_LINUX TRUE)
-  set(LIBC_TARGET_OS "linux")
-elseif(LIBC_TARGET_OS STREQUAL "suse")
+  #
   # openSUSE uses different triple format which causes LIBC_TARGET_OS to be
   # computed as "suse" instead of "linux".
   set(LIBC_TARGET_OS_IS_LINUX TRUE)



More information about the libc-commits mailing list