[libc-commits] [libc] [libc][NFC] Make add_header_library rule support COMPILE_OPTIONS. (PR #65821)

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Fri Sep 8 16:08:38 PDT 2023


https://github.com/sivachandra created https://github.com/llvm/llvm-project/pull/65821:

The options added via COMPILE_OPTIONS will be treated as INTERFACE
options. This will help in setting compile options based on libc config
options in future patches.


>From 526321a03ba07ccc64c6cba12e28eece94b95f51 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy <sivachandra at google.com>
Date: Fri, 8 Sep 2023 15:40:08 -0700
Subject: [PATCH] [libc][NFC] Make add_header_library rule support
 COMPILE_OPTIONS.

The options added via COMPILE_OPTIONS will be treated as INTERFACE
options. This will help in setting compile options based on libc config
options in future patches.
---
 libc/cmake/modules/LLVMLibCLibraryRules.cmake | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
index c2e5594a09fc321..8ffe2d3b739926c 100644
--- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -152,7 +152,7 @@ function(create_header_library fq_target_name)
     "ADD_HEADER"
     "" # Optional arguments
     "" # Single value arguments
-    "HDRS;DEPENDS;FLAGS" # Multi-value arguments
+    "HDRS;DEPENDS;FLAGS;COMPILE_OPTIONS" # Multi-value arguments
     ${ARGN}
   )
 
@@ -187,6 +187,9 @@ function(create_header_library fq_target_name)
     PROPERTIES
       INTERFACE_FLAGS "${ADD_HEADER_FLAGS}"
   )
+  if(ADD_HEADER_COMPILE_OPTIONS)
+    target_compile_options(${interface_target_name} INTERFACE ${ADD_HEADER_COMPILE_OPTIONS})
+  endif()
 
   add_custom_target(${fq_target_name})
   add_dependencies(${fq_target_name} ${interface_target_name})



More information about the libc-commits mailing list