[libunwind][CMake] Provide option to disable instalation of the library
This is useful in cases where we only build static library and libunwind.a is combined with libc++abi.a into a single archive in which case we don't want to have libunwind.a installed separately. The same option is already provided by libcxx CMake build. This change also adds the install-unwind target for consistency with the libcxxabi and libcxx CMake build. Differential Revision: https://reviews.llvm.org/D40195 llvm-svn: 318569
This commit is contained in:
parent
aa96d2ebbc
commit
b74f98c4e4
|
@ -135,6 +135,7 @@ option(LIBUNWIND_INCLUDE_DOCS "Build the libunwind documentation." ${LLVM_INCLUD
|
||||||
|
|
||||||
set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
||||||
"Define suffix of library directory name (32/64)")
|
"Define suffix of library directory name (32/64)")
|
||||||
|
option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON)
|
||||||
set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
|
set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
|
||||||
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
|
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
|
||||||
set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
|
set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
|
||||||
|
|
|
@ -132,7 +132,16 @@ endif()
|
||||||
# Add a meta-target for both libraries.
|
# Add a meta-target for both libraries.
|
||||||
add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS})
|
add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS})
|
||||||
|
|
||||||
install(TARGETS ${LIBUNWIND_TARGETS}
|
if (LIBUNWIND_INSTALL_LIBRARY)
|
||||||
LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX}
|
install(TARGETS ${LIBUNWIND_TARGETS}
|
||||||
ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX})
|
LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
|
||||||
|
ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
|
||||||
|
add_custom_target(install-unwind
|
||||||
|
DEPENDS unwind
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-DCMAKE_INSTALL_COMPONENT=unwind
|
||||||
|
-P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue