Author: phosek Date: Tue Jul 24 16:27:51 2018 New Revision: 337867 URL: http://llvm.org/viewvc/llvm-project?rev=337867&view=rev Log: [CMake] Option to control whether shared/static library is installed
Currently it's only possible to control whether shared or static library build of libc++, libc++abi and libunwind is enabled or disabled and whether to install everything we've built or not. However, it'd be useful to have more fine grained control, e.g. when static libraries are merged together into libc++.a we don't need to install libc++abi.a and libunwind.a. This change adds this option. Differential Revision: https://reviews.llvm.org/D49573 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=337867&r1=337866&r2=337867&view=diff ============================================================================== --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Tue Jul 24 16:27:51 2018 @@ -137,6 +137,12 @@ option(LIBUNWIND_INCLUDE_DOCS "Build the set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "Define suffix of library directory name (32/64)") option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON) +cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY + "Install the static libunwind library." ON + "LIBUNWIND_ENABLE_STATIC;LIBUNWIND_INSTALL_LIBRARY" OFF) +cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY + "Install the shared libunwind library." ON + "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF) set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.") set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.") Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=337867&r1=337866&r2=337867&view=diff ============================================================================== --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Tue Jul 24 16:27:51 2018 @@ -103,8 +103,6 @@ set_target_properties(unwind_objects COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}" POSITION_INDEPENDENT_CODE ON) -set(LIBUNWIND_TARGETS) - # Build the shared library. if (LIBUNWIND_ENABLE_SHARED) add_library(unwind_shared SHARED $<TARGET_OBJECTS:unwind_objects>) @@ -118,7 +116,10 @@ if (LIBUNWIND_ENABLE_SHARED) OUTPUT_NAME "unwind" VERSION "1.0" SOVERSION "1") - list(APPEND LIBUNWIND_TARGETS "unwind_shared") + list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared") + if (LIBUNWIND_INSTALL_SHARED_LIBRARY) + list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared") + endif() endif() # Build the static library. @@ -129,14 +130,17 @@ if (LIBUNWIND_ENABLE_STATIC) PROPERTIES LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}" OUTPUT_NAME "unwind") - list(APPEND LIBUNWIND_TARGETS "unwind_static") + list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static") + if (LIBUNWIND_INSTALL_STATIC_LIBRARY) + list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static") + endif() endif() # Add a meta-target for both libraries. -add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS}) +add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS}) if (LIBUNWIND_INSTALL_LIBRARY) - install(TARGETS ${LIBUNWIND_TARGETS} + install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind) endif() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits