mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
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
This commit is contained in:
parent
5c0f9f19d0
commit
83a9aec0c9
@ -69,14 +69,18 @@ endfunction(llvm_process_sources)
|
||||
|
||||
function(llvm_check_source_file_list)
|
||||
cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
|
||||
set(listed ${ARG_UNPARSED_ARGUMENTS})
|
||||
foreach(l ${ARG_UNPARSED_ARGUMENTS})
|
||||
get_filename_component(fp ${l} REALPATH)
|
||||
list(APPEND listed ${fp})
|
||||
endforeach()
|
||||
|
||||
if(ARG_SOURCE_DIR)
|
||||
file(GLOB globbed
|
||||
RELATIVE "${CMAKE_CURRENT_LIST_DIR}"
|
||||
"${ARG_SOURCE_DIR}/*.c" "${ARG_SOURCE_DIR}/*.cpp")
|
||||
else()
|
||||
file(GLOB globbed *.c *.cpp)
|
||||
endif()
|
||||
|
||||
foreach(g ${globbed})
|
||||
get_filename_component(fn ${g} NAME)
|
||||
if(ARG_SOURCE_DIR)
|
||||
@ -84,15 +88,21 @@ function(llvm_check_source_file_list)
|
||||
else()
|
||||
set(entry "${fn}")
|
||||
endif()
|
||||
get_filename_component(gp ${g} REALPATH)
|
||||
|
||||
# Don't reject hidden files. Some editors create backups in the
|
||||
# same directory as the file.
|
||||
if (NOT "${fn}" MATCHES "^\\.")
|
||||
list(FIND LLVM_OPTIONAL_SOURCES ${entry} idx)
|
||||
if( idx LESS 0 )
|
||||
list(FIND listed ${entry} idx)
|
||||
list(FIND listed ${gp} idx)
|
||||
if( idx LESS 0 )
|
||||
message(SEND_ERROR "Found unknown source file ${g}
|
||||
if(ARG_SOURCE_DIR)
|
||||
set(fn_relative "${ARG_SOURCE_DIR}/${fn}")
|
||||
else()
|
||||
set(fn_relative "${fn}")
|
||||
endif()
|
||||
message(SEND_ERROR "Found unknown source file ${fn_relative}
|
||||
Please update ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user