[PATCH] D13215: [CMake] Make the bindir and libdir arguments to set_output_directory optional

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 08:58:51 PDT 2015


john.brawn created this revision.
john.brawn added reviewers: chapuni, chandlerc, beanz.
john.brawn added a subscriber: llvm-commits.
john.brawn set the repository for this revision to rL LLVM.

When building a plugin against an installed LLVM toolchain using add_llvm_loadable_module (in the documented manner) doesn't work as nothing sets the *_OUTPUT_INTDIR variables causing an error when set_output_directory is called. Making those arguments optional (causing the default output directory to be used) fixes this.


Repository:
  rL LLVM

http://reviews.llvm.org/D13215

Files:
  cmake/modules/AddLLVM.cmake

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()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13215.35877.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150928/bfc902d2/attachment.bin>


More information about the llvm-commits mailing list