[clang] [Clang][CMake] fix header target creation (PR #180609)

Victor Mustya via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 9 12:53:19 PST 2026


https://github.com/vmustya created https://github.com/llvm/llvm-project/pull/180609

The `add_header_target` function was using a `file_list` parameter that
was supposed to capture all the header files that should be added to the
interface library target. However, the parameter was only capturing the
first header file, and the rest of the header files were not being added
to the target properties. I.e. the `get_target_properties` command was
only returning the first header file instead of all the header files.

The commit removes the `file_list` parameter and replaces it with `ARGN`,
which captures all the header files passed to the function. This ensures
that all the header files are added to the interface library target and
can be accessed through the target properties.

>From d70d1520d799d68f5cf6cb5c47ccbfe5556832c5 Mon Sep 17 00:00:00 2001
From: Victor Mustya <victor.mustya at intel.com>
Date: Mon, 9 Feb 2026 12:49:24 -0800
Subject: [PATCH] [Clang][CMake] fix header target creation

The `add_header_target` function was using a `file_list` parameter that
was supposed to capture all the header files that should be added to the
interface library target. However, the parameter was only capturing the
first header file, and the rest of the header files were not being added
to the target properties. I.e. the `get_target_properties` command was
only returning the first header file instead of all the header files.

The commit removes the `file_list` parameter and replaces it with `ARGN`,
which captures all the header files passed to the function. This ensures
that all the header files are added to the interface library target and
can be accessed through the target properties.
---
 clang/lib/Headers/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index c92b370b88d2d..95d20bbca79ac 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -516,8 +516,8 @@ foreach( f ${generated_files} )
   endif()
 endforeach( f )
 
-function(add_header_target target_name file_list)
-  add_library(${target_name} INTERFACE ${file_list})
+function(add_header_target target_name)
+  add_library(${target_name} INTERFACE ${ARGN})
   set_target_properties(${target_name} PROPERTIES
     FOLDER "Clang/Resources"
     RUNTIME_OUTPUT_DIRECTORY "${output_dir}")



More information about the cfe-commits mailing list