[libcxx-commits] [PATCH] D116873: [libunwind][cmake] Create `LIBUNWIND_INSTALL_INCLUDE_DIR` CACHE PATH

John Ericson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 8 16:12:24 PST 2022


Ericson2314 created this revision.
Ericson2314 added reviewers: beanz, phosek.
Herald added subscribers: libcxx-commits, mgorny.
Herald added a project: libunwind.
Herald added a reviewer: libunwind.
Ericson2314 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is created on analogy with the other CACHE PATHs in this package,
and other `*_INSTALL_INCLUDE_DIR` in other packages.

The `LLVM_LIBRARY_OUTPUT_INTDIR` is branching is adjusted to deduplicate
some existing code, and likewise avoid having to define this new
variable more times.

This will be used for D99484 <https://reviews.llvm.org/D99484>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116873

Files:
  libunwind/CMakeLists.txt
  libunwind/include/CMakeLists.txt


Index: libunwind/include/CMakeLists.txt
===================================================================
--- libunwind/include/CMakeLists.txt
+++ libunwind/include/CMakeLists.txt
@@ -14,7 +14,7 @@
   foreach(file ${files})
     get_filename_component(dir ${file} DIRECTORY)
     install(FILES ${file}
-      DESTINATION "include/${dir}"
+      DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}"
       COMPONENT unwind-headers
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     )
Index: libunwind/CMakeLists.txt
===================================================================
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -139,6 +139,8 @@
 
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+  set(LIBUNWIND_INSTALL_INCLUDE_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
+      "Path where built libunwind headers should be installed.")
   set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
       "Path where built libunwind libraries should be installed.")
   set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
@@ -147,14 +149,14 @@
     string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
     string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
   endif()
-elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
-  set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
-      "Path where built libunwind libraries should be installed.")
-  set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
-      "Path where built libunwind runtime libraries should be installed.")
-else()
-  set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+else
+  if(LLVM_LIBRARY_OUTPUT_INTDIR)
+    set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  else()
+    set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+  endif()
+  set(LIBUNWIND_INSTALL_INCLUDE_DIR include CACHE PATH
+      "Path where built libunwind headers should be installed.")
   set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
       "Path where built libunwind libraries should be installed.")
   set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116873.398381.patch
Type: text/x-patch
Size: 2369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220109/93fd1495/attachment.bin>


More information about the libcxx-commits mailing list