Skip to content

Commit 1447c97

Browse files
committedMar 19, 2018
Accept any filepath in llvm_check_source_file_list
Cmake function llvm_check_source_file_list currently only accepts paths relative to current CMAKE_SOURCE_DIR or relative to argument SOURCE_DIR. Extend it to accept any path, including absolute ones. Differential revision: https://reviews.llvm.org/D44625 llvm-svn: 327912
1 parent 2ecc0d3 commit 1447c97

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed
 

‎llvm/cmake/modules/LLVMProcessSources.cmake

+14-4
Original file line numberDiff line numberDiff line change
@@ -69,30 +69,40 @@ endfunction(llvm_process_sources)
6969

7070
function(llvm_check_source_file_list)
7171
cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
72-
set(listed ${ARG_UNPARSED_ARGUMENTS})
72+
foreach(l ${ARG_UNPARSED_ARGUMENTS})
73+
get_filename_component(fp ${l} REALPATH)
74+
list(APPEND listed ${fp})
75+
endforeach()
76+
7377
if(ARG_SOURCE_DIR)
7478
file(GLOB globbed
75-
RELATIVE "${CMAKE_CURRENT_LIST_DIR}"
7679
"${ARG_SOURCE_DIR}/*.c" "${ARG_SOURCE_DIR}/*.cpp")
7780
else()
7881
file(GLOB globbed *.c *.cpp)
7982
endif()
83+
8084
foreach(g ${globbed})
8185
get_filename_component(fn ${g} NAME)
8286
if(ARG_SOURCE_DIR)
8387
set(entry "${g}")
8488
else()
8589
set(entry "${fn}")
8690
endif()
91+
get_filename_component(gp ${g} REALPATH)
8792

8893
# Don't reject hidden files. Some editors create backups in the
8994
# same directory as the file.
9095
if (NOT "${fn}" MATCHES "^\\.")
9196
list(FIND LLVM_OPTIONAL_SOURCES ${entry} idx)
9297
if( idx LESS 0 )
93-
list(FIND listed ${entry} idx)
98+
list(FIND listed ${gp} idx)
9499
if( idx LESS 0 )
95-
message(SEND_ERROR "Found unknown source file ${g}
100+
if(ARG_SOURCE_DIR)
101+
set(fn_relative "${ARG_SOURCE_DIR}/${fn}")
102+
else()
103+
set(fn_relative "${fn}")
104+
endif()
105+
message(SEND_ERROR "Found unknown source file ${fn_relative}
96106
Please update ${CMAKE_CURRENT_LIST_FILE}\n")
97107
endif()
98108
endif()

0 commit comments

Comments
 (0)
Please sign in to comment.