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.
Details
Diff Detail
Event Timeline
llvm/cmake/modules/LLVMProcessSources.cmake | ||
---|---|---|
35 | I'd add a comment explaining this is for broken symlinks, otherwise I'd be wondering why you were checking for the existence of a file you just globbed... Actually, is EXISTS resolving symlinks documented anywhere? It's unclear if it would return the existence of the symlink itself or the target of the symlink. |
llvm/cmake/modules/LLVMProcessSources.cmake | ||
---|---|---|
35 |
Good idea.
To be honest, I don't see it in CMake docs. I think I presumed that behavior from shell's -f operator but there's indeed some potential ambiguity here. |
LGTM with the comment added.
llvm/cmake/modules/LLVMProcessSources.cmake | ||
---|---|---|
35 | Looks like it just calls access, which should resolve symlinks. |
llvm/cmake/modules/LLVMProcessSources.cmake | ||
---|---|---|
35 | I submitted https://gitlab.kitware.com/cmake/cmake/merge_requests/3189 to CMake to clarify this. |
llvm/cmake/modules/LLVMProcessSources.cmake | ||
---|---|---|
35 | Thank you. I'll add the comment later today and push it. |
I'd add a comment explaining this is for broken symlinks, otherwise I'd be wondering why you were checking for the existence of a file you just globbed...
Actually, is EXISTS resolving symlinks documented anywhere? It's unclear if it would return the existence of the symlink itself or the target of the symlink.