[libc-commits] [libc] [libc] Make add_header and add_gen_header targets normal library targets. (PR #66045)

via libc-commits libc-commits at lists.llvm.org
Mon Sep 11 22:55:01 PDT 2023


llvmbot wrote:

@llvm/pr-subscribers-libc

<details>
<summary>Changes</summary>

This way, they can be added as deps to other library targets without any
special handling.

--
Full diff: https://github.com/llvm/llvm-project/pull/66045.diff

1 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCHeaderRules.cmake (+16-3) 


<pre>
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 8aff65d9fcd8b5f..6168c0292f42af0 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -30,8 +30,9 @@ function(add_header target_name)
   )
 
   get_fq_target_name(${target_name} fq_target_name)
+  set(copied_hdr_target ${fq_target_name}.__copied_hdr__)
   add_custom_target(
-    ${fq_target_name}
+    ${copied_hdr_target}
     DEPENDS ${dest_file}
   )
 
@@ -46,10 +47,15 @@ function(add_header target_name)
       endif()
     endforeach()
     add_dependencies(
-      ${fq_target_name} ${fq_deps_list}
+      ${copied_hdr_target} ${fq_deps_list}
     )
   endif()
 
+  add_header_library(
+    ${target_name}
+    HDRS
+      ${dest_file}
+  )
   set_target_properties(
     ${fq_target_name}
     PROPERTIES
@@ -159,11 +165,18 @@ function(add_gen_header target_name)
       endif()
     endforeach()
   endif()
+  set(generated_hdr_target ${fq_target_name}.__generated_hdr__)
   add_custom_target(
-    ${fq_target_name}
+    ${generated_hdr_target}
     DEPENDS ${out_file} ${fq_deps_list} ${decl_out_file}
   )
 
+  add_header_library(
+    ${target_name}
+    HDRS
+      ${out_file}
+  )
+
   set_target_properties(
     ${fq_target_name}
     PROPERTIES
</pre>

</details>

https://github.com/llvm/llvm-project/pull/66045


More information about the libc-commits mailing list