[libunwind][cmake] Create LIBUNWIND_INSTALL_INCLUDE_DIR CACHE PATH

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

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

This will be used for D99484.

Reviewed By: #libunwind, compnerd

Differential Revision: https://reviews.llvm.org/D116873
This commit is contained in:
John Ericson 2022-01-09 00:08:15 +00:00
parent 4d81a46f7f
commit 914fffc7f2
2 changed files with 11 additions and 12 deletions

View file

@ -141,26 +141,25 @@ 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_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
"Path where built libunwind runtime libraries should be installed.")
if(LIBCXX_LIBDIR_SUBDIR)
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})
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_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.")
endif()
set(LIBUNWIND_INSTALL_INCLUDE_DIR include CACHE PATH
"Path where built libunwind headers should be installed.")
set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
"Path where built libunwind runtime libraries should be installed.")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})

View file

@ -14,7 +14,7 @@ if(LIBUNWIND_INSTALL_HEADERS)
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
)