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

via libc-commits libc-commits at lists.llvm.org
Tue Sep 12 08:50:10 PDT 2023


Author: Siva Chandra
Date: 2023-09-12T08:50:05-07:00
New Revision: 9048aa71aff1ce942dad6bfa5224536c643f84cf

URL: https://github.com/llvm/llvm-project/commit/9048aa71aff1ce942dad6bfa5224536c643f84cf
DIFF: https://github.com/llvm/llvm-project/commit/9048aa71aff1ce942dad6bfa5224536c643f84cf.diff

LOG: [libc] Make add_header and add_gen_header targets normal library targets. (#66045)

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

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCHeaderRules.cmake

Removed: 
    


################################################################################
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


        


More information about the libc-commits mailing list