[PATCH] D37859: [cmake] Add SOURCE_DIR argument to llvm_check_source_file_list
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 12:31:51 PDT 2017
smeenai created this revision.
Herald added a subscriber: mgorny.
The motivation is to be able to check sources outside the current
directory. See https://reviews.llvm.org/D31363 for example usage.
https://reviews.llvm.org/D37859
Files:
cmake/modules/LLVMProcessSources.cmake
Index: cmake/modules/LLVMProcessSources.cmake
===================================================================
--- cmake/modules/LLVMProcessSources.cmake
+++ cmake/modules/LLVMProcessSources.cmake
@@ -68,17 +68,29 @@
function(llvm_check_source_file_list)
- set(listed ${ARGN})
- file(GLOB globbed *.c *.cpp)
+ cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
+ set(listed ${ARG_UNPARSED_ARGUMENTS})
+ 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)
+ set(entry "${g}")
+ else()
+ set(entry "${fn}")
+ endif()
# 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 ${fn} idx)
+ list(FIND LLVM_OPTIONAL_SOURCES ${entry} idx)
if( idx LESS 0 )
- list(FIND listed ${fn} idx)
+ list(FIND listed ${entry} idx)
if( idx LESS 0 )
message(SEND_ERROR "Found unknown source file ${g}
Please update ${CMAKE_CURRENT_LIST_FILE}\n")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37859.115260.patch
Type: text/x-patch
Size: 1272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170914/49a41463/attachment.bin>
More information about the llvm-commits
mailing list