[PATCH] D33762: [libcxx][CMake] Add install path variable to allow overriding the destination

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 00:48:35 PDT 2017


phosek created this revision.
Herald added a subscriber: mgorny.
Herald added a reviewer: EricWF.

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


Repository:
  rL LLVM

https://reviews.llvm.org/D33762

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibCXXABI.cmake
  include/CMakeLists.txt
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -354,16 +354,16 @@
     set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-    LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
-    ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+    LIBRARY DESTINATION ${LIBCXX_INSTALL_PATH}/lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+    ARCHIVE DESTINATION ${LIBCXX_INSTALL_PATH}/lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
     )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
   if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
     # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
     # after we required CMake 3.0.
     install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
-      DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
+      DESTINATION ${LIBCXX_INSTALL_PATH}/lib${LIBCXX_LIBDIR_SUFFIX}
       COMPONENT libcxx)
   endif()
 endif()
Index: include/CMakeLists.txt
===================================================================
--- include/CMakeLists.txt
+++ include/CMakeLists.txt
@@ -20,7 +20,7 @@
 
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
-    DESTINATION include/c++/v1
+    DESTINATION ${LIBCXX_INSTALL_PATH}/include/c++/v1
     COMPONENT cxx-headers
     FILES_MATCHING
     ${LIBCXX_HEADER_PATTERN}
@@ -44,7 +44,7 @@
     set(generated_config_deps generate_config_header)
     # Install the generated header as __config.
     install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
-      DESTINATION include/c++/v1
+      DESTINATION ${LIBCXX_INSTALL_PATH}/include/c++/v1
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
       RENAME __config
       COMPONENT cxx-headers)
Index: cmake/Modules/HandleLibCXXABI.cmake
===================================================================
--- cmake/Modules/HandleLibCXXABI.cmake
+++ cmake/Modules/HandleLibCXXABI.cmake
@@ -55,7 +55,7 @@
           )
         if (LIBCXX_INSTALL_HEADERS)
           install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-            DESTINATION include/c++/v1/${dstdir}
+            DESTINATION ${LIBCXX_INSTALL_PATH}/include/c++/v1/${dstdir}
             COMPONENT libcxx
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
             )
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -351,6 +351,9 @@
 endif()
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
 
+set(LIBCXX_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+    "Path where libc++ library should be installed.")
+
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33762.100968.patch
Type: text/x-patch
Size: 2994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/c9cbcff9/attachment.bin>


More information about the llvm-commits mailing list