]> granicus.if.org Git - llvm/commitdiff
Merging r357701:
authorTom Stellard <tstellar@redhat.com>
Fri, 3 May 2019 01:51:07 +0000 (01:51 +0000)
committerTom Stellard <tstellar@redhat.com>
Fri, 3 May 2019 01:51:07 +0000 (01:51 +0000)
------------------------------------------------------------------------
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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_80@359857 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/LLVMProcessSources.cmake

index 7cbd2863500cf1ef606db7b16c474580f51d3147..d0be0e8b3ba3dbe2e606b3d7d5eda71db0d2c4de 100644 (file)
@@ -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)