[libcxxabi] r337867 - [CMake] Option to control whether shared/static library is installed
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 24 16:27:51 PDT 2018
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:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/src/CMakeLists.txt
Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=337867&r1=337866&r2=337867&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Tue Jul 24 16:27:51 2018
@@ -75,6 +75,13 @@ set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PAT
set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
+cmake_dependent_option(LIBCXXABI_INSTALL_STATIC_LIBRARY
+ "Install the static libc++abi library." ON
+ "LIBCXXABI_ENABLE_STATIC;LIBCXXABI_INSTALL_LIBRARY" OFF)
+cmake_dependent_option(LIBCXXABI_INSTALL_SHARED_LIBRARY
+ "Install the shared libc++abi library." ON
+ "LIBCXXABI_ENABLE_SHARED;LIBCXXABI_INSTALL_LIBRARY" OFF)
+
# Default to building a shared library so that the default options still test
# the libc++abi that is being built. There are two problems with testing a
# static libc++abi. In the case of a standalone build, the tests will link the
Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=337867&r1=337866&r2=337867&view=diff
==============================================================================
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Tue Jul 24 16:27:51 2018
@@ -129,8 +129,6 @@ set_target_properties(cxxabi_objects
POSITION_INDEPENDENT_CODE
ON)
-set(LIBCXXABI_TARGETS)
-
# Build the shared library.
if (LIBCXXABI_ENABLE_SHARED)
add_library(cxxabi_shared SHARED $<TARGET_OBJECTS:cxxabi_objects>)
@@ -156,7 +154,10 @@ if (LIBCXXABI_ENABLE_SHARED)
"1"
VERSION
"1.0")
- list(APPEND LIBCXXABI_TARGETS "cxxabi_shared")
+ list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
+ if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
+ list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
+ endif()
endif()
# Build the static library.
@@ -183,14 +184,17 @@ if (LIBCXXABI_ENABLE_STATIC)
"c++abi"
POSITION_INDEPENDENT_CODE
ON)
- list(APPEND LIBCXXABI_TARGETS "cxxabi_static")
+ list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_static")
+ if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
+ list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
+ endif()
endif()
# Add a meta-target for both libraries.
-add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
+add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
if (LIBCXXABI_INSTALL_LIBRARY)
- install(TARGETS ${LIBCXXABI_TARGETS}
+ install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
)
More information about the cfe-commits
mailing list