[libcxxabi][CMake] Add install path variable to allow overriding the destination

This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307611
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 2b3733d..99d4634 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -156,6 +156,13 @@
   set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 endif()
 
+set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING
+    "Define libc++abi destination prefix.")
+
+if (NOT LIBCXXABI_INSTALL_PREFIX MATCHES "^$|.*/")
+  message(FATAL_ERROR "LIBCXXABI_INSTALL_PREFIX has to end with \"/\".")
+endif()
+
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})