diff options
author | Shoaib Meenai <smeenai@fb.com> | 2017-09-19 17:44:42 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2017-09-19 17:44:42 +0000 |
commit | 6d72a2f9218cc4798bf433be19e3ff5dc121f083 (patch) | |
tree | f449f985b467fa91b5a3398ab8ee77e99ef8ce49 /cmake/modules | |
parent | 2e76b8570f15b2f1221117822ffcc91b30b59c59 (diff) | |
download | llvm-6d72a2f9218cc4798bf433be19e3ff5dc121f083.tar.gz |
[cmake] Add SOURCE_DIR argument to llvm_check_source_file_list
The motivation is to be able to check sources outside the current
directory. See D31363 for example usage.
Differential Revision: https://reviews.llvm.org/D37859
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/LLVMProcessSources.cmake | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmake/modules/LLVMProcessSources.cmake b/cmake/modules/LLVMProcessSources.cmake index ae1921b5bc0..3b4838daed5 100644 --- a/cmake/modules/LLVMProcessSources.cmake +++ b/cmake/modules/LLVMProcessSources.cmake @@ -68,17 +68,29 @@ endfunction(llvm_process_sources) 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") |