Index: cmake/modules/AddLLVM.cmake =================================================================== --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -193,7 +193,17 @@ # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}. # Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, # or a certain builder, for eaxample, msbuild.exe, would be confused. -function(set_output_directory target bindir libdir) +function(set_output_directory target) + # This function takes bindir and libdir arguments but allows them to be unset, + # in which case the default output directory is used (this is useful when + # using AddLLVM.cmake from an installed LLVM toolchain as they will end up + # being unset in that case). This is done by leaving those arguments off the + # argument list and instead getting them from ARGV. + if(${ARGC} LESS 3) + return() + endif() + set(bindir ${ARGV1}) + set(libdir ${ARGV2}) # Do nothing if *_OUTPUT_INTDIR is empty. if("${bindir}" STREQUAL "") return()