[libc-commits] [libc] [libc] Make add_header and add_gen_header targets normal library targets. (PR #66045)
Siva Chandra via libc-commits
libc-commits at lists.llvm.org
Mon Sep 11 22:54:03 PDT 2023
https://github.com/sivachandra created https://github.com/llvm/llvm-project/pull/66045:
This way, they can be added as deps to other library targets without any
special handling.
>From 4bbab3eb5176d467c74415473f55cf8de257b817 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy <sivachandra at google.com>
Date: Tue, 12 Sep 2023 00:05:11 +0000
Subject: [PATCH] [libc] Make add_header and add_gen_header targets normal
library targets.
This way, they can be added as deps to other library targets without any
special handling.
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
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