[clang] NFC: Make clang resource headers an interface library (PR #88317)
Evan Wilde via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 10 14:36:56 PDT 2024
https://github.com/etcwilde updated https://github.com/llvm/llvm-project/pull/88317
>From 753df93a4fc054328c0b7caacc1064c283ced8ec Mon Sep 17 00:00:00 2001
From: Evan Wilde <etceterawilde at gmail.com>
Date: Thu, 14 Mar 2024 18:11:24 -0700
Subject: [PATCH] Make clang resource headers an interface library
Making the clang resource headers into an interface library means that
we can attach the header search paths to the library. Targets that
"link" against this library will automatically have the appropriate
paths added to their header search paths to find them.
---
clang/lib/Headers/CMakeLists.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 97104ccd8db59c..e6ae4e19e81db9 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -437,14 +437,14 @@ foreach( f ${generated_files} )
endforeach( f )
function(add_header_target target_name file_list)
- add_custom_target(${target_name} DEPENDS ${file_list})
+ add_library(${target_name} INTERFACE ${file_list})
set_target_properties(${target_name} PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
endfunction()
# The catch-all clang-resource-headers target
-add_custom_target("clang-resource-headers" ALL DEPENDS ${out_files})
+add_library(clang-resource-headers INTERFACE ${out_files})
set_target_properties("clang-resource-headers" PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
@@ -501,6 +501,10 @@ add_header_target("windows-resource-headers" ${windows_only_files})
add_header_target("utility-resource-headers" ${utility_files})
get_clang_resource_dir(header_install_dir SUBDIR include)
+target_include_directories(clang-resource-headers INTERFACE
+ $<BUILD_INTERFACE:${output_dir}>
+ $<INSTALL_INTERFACE:${header_install_dir}>)
+set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS clang-resource-headers)
#############################################################
# Install rules for the catch-all clang-resource-headers target
More information about the cfe-commits
mailing list