Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] Make add_header and add_gen_header targets normal library targets. #66045

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

sivachandra
Copy link
Collaborator

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

…ets.

This way, they can be added as deps to other library targets without any
special handling.
@sivachandra sivachandra requested a review from a team as a code owner September 12, 2023 05:53
@llvmbot llvmbot added the libc label Sep 12, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 12, 2023

@llvm/pr-subscribers-libc

Changes

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

@sivachandra sivachandra merged commit 9048aa7 into llvm:main Sep 12, 2023
2 checks passed
@sivachandra sivachandra deleted the make_gen_header_target_a_library branch September 13, 2023 16:08
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…ets. (llvm#66045)

This way, they can be added as deps to other library targets without any
special handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants