1set(files
2    __libunwind_config.h
3    libunwind.h
4    libunwind.modulemap
5    mach-o/compact_unwind_encoding.h
6    mach-o/compact_unwind_encoding.modulemap
7    unwind_arm_ehabi.h
8    unwind_itanium.h
9    unwind.h
10    )
11
12add_library(unwind-headers INTERFACE)
13target_include_directories(unwind-headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
14
15if(LIBUNWIND_INSTALL_HEADERS)
16  foreach(file ${files})
17    get_filename_component(dir ${file} DIRECTORY)
18    install(FILES ${file}
19      DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}"
20      COMPONENT unwind-headers
21      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
22    )
23  endforeach()
24
25  if(NOT CMAKE_CONFIGURATION_TYPES)
26    add_custom_target(install-unwind-headers
27      DEPENDS unwind-headers
28      COMMAND "${CMAKE_COMMAND}"
29              -DCMAKE_INSTALL_COMPONENT=unwind-headers
30              -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake")
31    add_custom_target(install-unwind-headers-stripped DEPENDS install-unwind-headers)
32  endif()
33endif()
34