diff options
| author | Michal Gorny <mgorny@gentoo.org> | 2019-04-04 14:21:38 +0000 |
|---|---|---|
| committer | Michal Gorny <mgorny@gentoo.org> | 2019-04-04 14:21:38 +0000 |
| commit | 1f68002cb725c6a8fb5ca8425c1c86495a053f4f (patch) | |
| tree | ab28e2ad8493ecfd73402ed80e29ed43b4f2a354 /llvm/cmake/modules/LLVMProcessSources.cmake | |
| parent | ffff492128eec117eeaba7b29967b6bbb7f2b989 (diff) | |
| download | bcm5719-llvm-1f68002cb725c6a8fb5ca8425c1c86495a053f4f.tar.gz bcm5719-llvm-1f68002cb725c6a8fb5ca8425c1c86495a053f4f.zip | |
[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: 357701
Diffstat (limited to 'llvm/cmake/modules/LLVMProcessSources.cmake')
| -rw-r--r-- | llvm/cmake/modules/LLVMProcessSources.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake index 7cbd2863500..d0be0e8b3ba 100644 --- a/llvm/cmake/modules/LLVMProcessSources.cmake +++ b/llvm/cmake/modules/LLVMProcessSources.cmake @@ -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) |

