Index: libunwind/CMakeLists.txt =================================================================== --- libunwind/CMakeLists.txt +++ libunwind/CMakeLists.txt @@ -78,6 +78,7 @@ option(LIBUNWIND_IS_BAREMETAL "Build libunwind for baremetal targets." OFF) option(LIBUNWIND_USE_FRAME_HEADER_CACHE "Cache frame headers for unwinding. Requires locking dl_iterate_phdr." OFF) option(LIBUNWIND_REMEMBER_HEAP_ALLOC "Use heap instead of the stack for .cfi_remember_state." OFF) +option(LIBUNWIND_INSTALL_HEADERS "Install the libunwind headers." OFF) set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "Define suffix of library directory name (32/64)") @@ -383,3 +384,7 @@ if (LIBUNWIND_INCLUDE_TESTS AND EXISTS ${LLVM_CMAKE_DIR}) add_subdirectory(test) endif() + +if(LIBUNWIND_INSTALL_HEADERS) + add_subdirectory(include) +endif() Index: libunwind/include/CMakeLists.txt =================================================================== --- /dev/null +++ libunwind/include/CMakeLists.txt @@ -0,0 +1,29 @@ +set(files + __libunwind_config.h + libunwind.h + unwind_arm_ehabi.h + unwind_itanium.h + unwind.h + ) + +add_library(unwind-headers INTERFACE) + +install(FILES ${files} + DESTINATION include + COMPONENT unwind-headers + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) + +if(NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY) + 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 unwind-headers + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=unwind-headers + -DCMAKE_INSTALL_DO_STRIP=1 + -P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake") +endif()