[PATCH] D59632: [llvm] [cmake] Add additional headers only if they exist

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 23:18:40 PDT 2019


mgorny created this revision.
mgorny added reviewers: beanz, chapuni.
Herald added a project: LLVM.

Modify the add_header_files_for_glob() function to only add files
that do exist, rather than all matches of the glob.  This fixes CMake
error when one of the include directories (which happen to include
/usr/include) contain broken symlinks.


https://reviews.llvm.org/D59632

Files:
  llvm/cmake/modules/LLVMProcessSources.cmake


Index: llvm/cmake/modules/LLVMProcessSources.cmake
===================================================================
--- llvm/cmake/modules/LLVMProcessSources.cmake
+++ llvm/cmake/modules/LLVMProcessSources.cmake
@@ -30,7 +30,13 @@
 
 function(add_header_files_for_glob hdrs_out glob)
   file(GLOB hds ${glob})
-  set(${hdrs_out} ${hds} PARENT_SCOPE)
+  set(filtered)
+  foreach(file ${hds})
+    if(EXISTS ${file})
+      list(APPEND filtered ${file})
+    endif()
+  endforeach()
+  set(${hdrs_out} ${filtered} PARENT_SCOPE)
 endfunction(add_header_files_for_glob)
 
 function(find_all_header_files hdrs_out additional_headerdirs)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59632.191637.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190321/84f0474a/attachment.bin>


More information about the llvm-commits mailing list