[libc-commits] [libc] [libc] Add libc-headers-build custom target (PR #191160)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Thu Apr 9 10:05:03 PDT 2026


================
@@ -935,6 +935,7 @@ endfunction(get_all_install_header_targets)
 get_all_install_header_targets(all_install_header_targets ${TARGET_PUBLIC_HEADERS})
 add_library(libc-headers INTERFACE)
 add_dependencies(libc-headers ${all_install_header_targets})
+add_custom_target(libc-headers-build DEPENDS libc-headers)
----------------
petrhosek wrote:

In [libc++ we use the inverse setup](https://github.com/llvm/llvm-project/blob/fa7f5cf6f665f2380a7103bccce58a01ea673b8c/libcxx/include/CMakeLists.txt#L1715-L1719) where we make the custom target depend on the header targets and then make the interface target depend on that, in libc it'd look like this:
```suggestion
add_custom_target(generate-libc-headers ALL DEPENDS ${all_install_header_targets})
add_library(libc-headers INTERFACE)
add_dependencies(libc-headers generate-libc-headers)
```

https://github.com/llvm/llvm-project/pull/191160


More information about the libc-commits mailing list