[libc-commits] [libc] [libc] Only use COMPILER_RESOURCE_DIR if available (PR #97465)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Tue Jul 2 12:42:31 PDT 2024


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

This avoids build error when COMPILER_RESOURCE_DIR is unset.

>From 9881b1aae1aeb4d1dbb68cabe930cb8ca213961b Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 2 Jul 2024 12:40:33 -0700
Subject: [PATCH] [libc] Only use COMPILER_RESOURCE_DIR if available

This avoids build error when COMPILER_RESOURCE_DIR is unset.
---
 libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index d283e966bffcf..28379213029a3 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -50,7 +50,7 @@ function(_get_common_compile_options output_var flags)
       # being included.
       if(LIBC_CC_SUPPORTS_NOSTDLIBINC)
         list(APPEND compile_options "-nostdlibinc")
-      else()
+      elseif(COMPILER_RESOURCE_DIR)
         list(APPEND compile_options "-isystem${COMPILER_RESOURCE_DIR}/include")
         list(APPEND compile_options "-nostdinc")
       endif()



More information about the libc-commits mailing list