diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-03-19 21:35:30 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-03-19 21:35:30 +0000 |
commit | c1a9456cbdd128825080bb55772eec003723828c (patch) | |
tree | 30901182d91e552f2b26f12ea62af9889abf52bf /cmake/modules/LLVMProcessSources.cmake | |
parent | f19689a8da2fe976bbaf28dc6f0ce1647479f177 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/modules/LLVMProcessSources.cmake')
-rw-r--r-- | cmake/modules/LLVMProcessSources.cmake | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cmake/modules/LLVMProcessSources.cmake b/cmake/modules/LLVMProcessSources.cmake index 8b7dc65d949..f65f31d797c 100644 --- a/cmake/modules/LLVMProcessSources.cmake +++ b/cmake/modules/LLVMProcessSources.cmake @@ -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() |