Skip to content

Conversation

sivachandra
Copy link
Collaborator

Also, we removed CMP0076 exception sometime back but did not adjust the
build rules. The adjustment in the build rules is also done in this
patch.

Also, we removed CMP0076 exception sometime back but did not adjust the
build rules. The adjustment in the build rules is also done in this
patch.
@sivachandra sivachandra requested a review from a team as a code owner September 12, 2023 18:44
@llvmbot llvmbot added the libc label Sep 12, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 12, 2023

@llvm/pr-subscribers-libc

Changes

Also, we removed CMP0076 exception sometime back but did not adjust the
build rules. The adjustment in the build rules is also done in this
patch.

--
Full diff: https://github.com/llvm/llvm-project/pull/66125.diff

2 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCHeaderRules.cmake (+4)
  • (modified) libc/cmake/modules/LLVMLibCLibraryRules.cmake (+1-8)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 6168c0292f42af0..e259a512ea760f6 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -55,6 +55,8 @@ function(add_header target_name)
     ${target_name}
     HDRS
       ${dest_file}
+    DEPENDS
+      ${copied_hdr_target}
   )
   set_target_properties(
     ${fq_target_name}
@@ -175,6 +177,8 @@ function(add_gen_header target_name)
     ${target_name}
     HDRS
       ${out_file}
+    DEPENDS
+      ${generated_hdr_target}
   )
 
   set_target_properties(
diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
index 40a4cf647762e1d..76852f714afd3a8 100644
--- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -160,13 +160,6 @@ function(create_header_library fq_target_name)
     message(FATAL_ERROR "'add_header_library' target requires a HDRS list of .h files.")
   endif()
 
-  set(FULL_HDR_PATHS "")
-  # TODO: Remove this foreach block when we can switch to the new
-  # version of the CMake policy CMP0076.
-  foreach(hdr IN LISTS ADD_HEADER_HDRS)
-    list(APPEND FULL_HDR_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${hdr})
-  endforeach()
-
   if(SHOW_INTERMEDIATE_OBJECTS)
     message(STATUS "Adding header library ${fq_target_name}")
     if(${SHOW_INTERMEDIATE_OBJECTS} STREQUAL "DEPS")
@@ -177,7 +170,7 @@ function(create_header_library fq_target_name)
   endif()
 
   add_library(${fq_target_name} INTERFACE)
-  target_sources(${fq_target_name} INTERFACE ${FULL_HDR_PATHS})
+  target_sources(${fq_target_name} INTERFACE ${ADD_HEADER_HDRS})
   if(ADD_HEADER_DEPENDS)
     add_dependencies(${fq_target_name} ${ADD_HEADER_DEPENDS})
   endif()

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This resolves the issues I was seeing locally.

@sivachandra sivachandra merged commit 0f31e56 into llvm:main Sep 12, 2023
@sivachandra sivachandra deleted the adjust_after_cmp0076 branch September 13, 2023 16:08
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
Also, we removed CMP0076 exception sometime back but did not adjust the
build rules. The adjustment in the build rules is also done in this
patch.
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