[llvm-branch-commits] [llvm-branch] r359857 - Merging r357701:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 2 18:51:07 PDT 2019


Author: tstellar
Date: Thu May  2 18:51:07 2019
New Revision: 359857

URL: http://llvm.org/viewvc/llvm-project?rev=359857&view=rev
Log:
Merging r357701:

------------------------------------------------------------------------
r357701 | mgorny | 2019-04-04 07:21:38 -0700 (Thu, 04 Apr 2019) | 8 lines

[llvm] [cmake] Add additional headers only if they exist

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.

Differential Revision: https://reviews.llvm.org/D59632
------------------------------------------------------------------------

Modified:
    llvm/branches/release_80/cmake/modules/LLVMProcessSources.cmake

Modified: llvm/branches/release_80/cmake/modules/LLVMProcessSources.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/cmake/modules/LLVMProcessSources.cmake?rev=359857&r1=359856&r2=359857&view=diff
==============================================================================
--- llvm/branches/release_80/cmake/modules/LLVMProcessSources.cmake (original)
+++ llvm/branches/release_80/cmake/modules/LLVMProcessSources.cmake Thu May  2 18:51:07 2019
@@ -30,7 +30,15 @@ endmacro(add_td_sources)
 
 function(add_header_files_for_glob hdrs_out glob)
   file(GLOB hds ${glob})
-  set(${hdrs_out} ${hds} PARENT_SCOPE)
+  set(filtered)
+  foreach(file ${hds})
+    # Explicit existence check is necessary to filter dangling symlinks
+    # out.  See https://bugs.gentoo.org/674662.
+    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)




More information about the llvm-branch-commits mailing list