Skip to content

Commit 9465a4c

Browse files
committed
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 ------------------------------------------------------------------------ llvm-svn: 359857
1 parent 68f2f7c commit 9465a4c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/cmake/modules/LLVMProcessSources.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ endmacro(add_td_sources)
3030

3131
function(add_header_files_for_glob hdrs_out glob)
3232
file(GLOB hds ${glob})
33-
set(${hdrs_out} ${hds} PARENT_SCOPE)
33+
set(filtered)
34+
foreach(file ${hds})
35+
# Explicit existence check is necessary to filter dangling symlinks
36+
# out. See https://bugs.gentoo.org/674662.
37+
if(EXISTS ${file})
38+
list(APPEND filtered ${file})
39+
endif()
40+
endforeach()
41+
set(${hdrs_out} ${filtered} PARENT_SCOPE)
3442
endfunction(add_header_files_for_glob)
3543

3644
function(find_all_header_files hdrs_out additional_headerdirs)

0 commit comments

Comments
 (0)