[llvm] [CMake][runtimes] Check LLVM_ENABLE_PROJECTS for libc (PR #76845)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 11:13:01 PST 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/76845

Only some targets may be building llvm-libc in which case the top-level LLVM_ENABLE_RUNTIMES variable won't contain libc. Rather, we can check LLVM_ENABLE_PROJECTS since libc is required to be included there for libc-hdrgen to be built (and when LLVM_ENABLE_RUNTIMES contains libc, we automatically include libc in LLVM_ENABLE_PROJECTS as well).

>From e608c241a59c456f6d5c7b4c33aae274b635d2ca Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Wed, 3 Jan 2024 19:10:26 +0000
Subject: [PATCH] [CMake][runtimes] Check LLVM_ENABLE_PROJECTS for libc

Only some targets may be building llvm-libc in which case the top-level
LLVM_ENABLE_RUNTIMES variable won't contain libc. Rather, we can check
LLVM_ENABLE_PROJECTS since libc is required to be included there for
libc-hdrgen to be built (and when LLVM_ENABLE_RUNTIMES contains libc,
we automatically include libc in LLVM_ENABLE_PROJECTS as well).
---
 llvm/runtimes/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 77254b7eb5e622..2e46c114af5fb2 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -414,7 +414,7 @@ if(runtimes)
       endif()
     endforeach()
   endif()
-  if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND 
+  if("libc" IN_LIST LLVM_ENABLE_PROJECTS AND
       (LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES))
     if(TARGET libc-hdrgen)
       set(libc_tools libc-hdrgen)



More information about the llvm-commits mailing list