Merge pull request #317 from aciidb0mb3r/use-custom-libdir-variable

[CMake] Use a custom variable for libdir path
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed53167..97d6a74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@
 include(CheckSymbolExists)
 include(GNUInstallDirs)
 
-set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Path where the libraries should be installed")
+set(INSTALL_LIBDIR "lib" CACHE PATH "Path where the libraries should be installed")
 set(WITH_BLOCKS_RUNTIME "" CACHE PATH "Path to blocks runtime")
 
 include(DispatchAppleOptions)
diff --git a/dispatch/CMakeLists.txt b/dispatch/CMakeLists.txt
index c13cfd8..971c068 100644
--- a/dispatch/CMakeLists.txt
+++ b/dispatch/CMakeLists.txt
@@ -14,12 +14,12 @@
           source.h
           time.h
         DESTINATION
-          "${CMAKE_INSTALL_LIBDIR}/swift/dispatch")
+          "${INSTALL_LIBDIR}/swift/dispatch")
 if(ENABLE_SWIFT)
   get_filename_component(MODULE_MAP module.modulemap REALPATH)
   install(FILES
             ${MODULE_MAP}
           DESTINATION
-            "${CMAKE_INSTALL_LIBDIR}/swift/dispatch")
+            "${INSTALL_LIBDIR}/swift/dispatch")
 endif()
 
diff --git a/os/CMakeLists.txt b/os/CMakeLists.txt
index bd26097..1c29616 100644
--- a/os/CMakeLists.txt
+++ b/os/CMakeLists.txt
@@ -6,5 +6,5 @@
           object.h
           linux_base.h
         DESTINATION
-          "${CMAKE_INSTALL_LIBDIR}/swift/os")
+          "${INSTALL_LIBDIR}/swift/os")
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2d937a4..5c793dc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -202,12 +202,12 @@
 install(TARGETS
           dispatch
         DESTINATION
-          "${CMAKE_INSTALL_LIBDIR}/swift/${SWIFT_OS}")
+          "${INSTALL_LIBDIR}/swift/${SWIFT_OS}")
 if(ENABLE_SWIFT)
   install(FILES
             ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
             ${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc
           DESTINATION
-            "${CMAKE_INSTALL_LIBDIR}/swift/${SWIFT_OS}/${CMAKE_SYSTEM_PROCESSOR}")
+            "${INSTALL_LIBDIR}/swift/${SWIFT_OS}/${CMAKE_SYSTEM_PROCESSOR}")
 endif()