[CMake] Avoid REVERSE on unset variable

If required_libs happens to remain unset, CMake would fail with:

  list sub-command REVERSE requires list to be present.

Fix by ensuring we do not attempt to reverse an unset variable.

Reported by Tu Vuong.

Differential Revision: https://reviews.llvm.org/D51799

llvm-svn: 343088
This commit is contained in:
Sven van Haastregt 2018-09-26 10:14:10 +00:00
parent 51909daeee
commit ad35f5366a

View File

@ -302,7 +302,9 @@ function(llvm_expand_dependencies out_libs)
expand_topologically(${lib} "${required_libs}" "${visited_libs}")
endforeach()
list(REVERSE required_libs)
if(required_libs)
list(REVERSE required_libs)
endif()
set(${out_libs} ${required_libs} PARENT_SCOPE)
endfunction()