Skip to content

Commit

Permalink
[llvm] [cmake] Add additional headers only if they exist
Browse files Browse the repository at this point in the history
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: 357701
  • Loading branch information
mgorny committed Apr 4, 2019
1 parent ffff492 commit 1f68002
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion llvm/cmake/modules/LLVMProcessSources.cmake
Expand Up @@ -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)
Expand Down

0 comments on commit 1f68002

Please sign in to comment.