llvm-project/libunwind/include/CMakeLists.txt
John Ericson 914fffc7f2 [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
2022-01-10 21:31:52 +00:00

32 lines
945 B
CMake

set(files
__libunwind_config.h
libunwind.h
mach-o/compact_unwind_encoding.h
unwind_arm_ehabi.h
unwind_itanium.h
unwind.h
)
add_library(unwind-headers INTERFACE)
target_include_directories(unwind-headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if(LIBUNWIND_INSTALL_HEADERS)
foreach(file ${files})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${file}
DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}"
COMPONENT unwind-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endforeach()
if(NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-unwind-headers
DEPENDS unwind-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=unwind-headers
-P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake")
add_custom_target(install-unwind-headers-stripped DEPENDS install-unwind-headers)
endif()
endif()