llvm.org GIT mirror llvm / 6d72a2f
[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 Shoaib Meenai 2 years ago
1 changed file(s) with 16 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
6767
6868
6969 function(llvm_check_source_file_list)
70 set(listed ${ARGN})
71 file(GLOB globbed *.c *.cpp)
70 cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
71 set(listed ${ARG_UNPARSED_ARGUMENTS})
72 if(ARG_SOURCE_DIR)
73 file(GLOB globbed
74 RELATIVE "${CMAKE_CURRENT_LIST_DIR}"
75 "${ARG_SOURCE_DIR}/*.c" "${ARG_SOURCE_DIR}/*.cpp")
76 else()
77 file(GLOB globbed *.c *.cpp)
78 endif()
7279 foreach(g ${globbed})
7380 get_filename_component(fn ${g} NAME)
81 if(ARG_SOURCE_DIR)
82 set(entry "${g}")
83 else()
84 set(entry "${fn}")
85 endif()
7486
7587 # Don't reject hidden files. Some editors create backups in the
7688 # same directory as the file.
7789 if (NOT "${fn}" MATCHES "^\\.")
78 list(FIND LLVM_OPTIONAL_SOURCES ${fn} idx)
90 list(FIND LLVM_OPTIONAL_SOURCES ${entry} idx)
7991 if( idx LESS 0 )
80 list(FIND listed ${fn} idx)
92 list(FIND listed ${entry} idx)
8193 if( idx LESS 0 )
8294 message(SEND_ERROR "Found unknown source file ${g}
8395 Please update ${CMAKE_CURRENT_LIST_FILE}\n")