[PATCH] D49573: [CMake] Option to control whether shared/static library is installed
Petr Hosek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 24 16:29:31 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX337867: [CMake] Option to control whether shared/static library is installed (authored by phosek, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49573?vs=156382&id=157170#toc
Repository:
rCXX libc++
https://reviews.llvm.org/D49573
Files:
CMakeLists.txt
lib/CMakeLists.txt
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -93,6 +93,12 @@
"Define suffix of library directory name (32/64)")
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
+cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
+ "Install the static libc++ library." ON
+ "LIBCXX_ENABLE_STATIC;LIBCXX_INSTALL_LIBRARY" OFF)
+cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY
+ "Install the shared libc++ library." ON
+ "LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF)
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
"Install libc++experimental.a" ON
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -220,8 +220,6 @@
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
)
-set(LIBCXX_TARGETS)
-
# Build the shared library.
if (LIBCXX_ENABLE_SHARED)
add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>)
@@ -236,7 +234,10 @@
VERSION "${LIBCXX_ABI_VERSION}.0"
SOVERSION "${LIBCXX_ABI_VERSION}"
)
- list(APPEND LIBCXX_TARGETS "cxx_shared")
+ list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
+ if (LIBCXX_INSTALL_SHARED_LIBRARY)
+ list(APPEND LIBCXX_INSTALL_TARGETS "cxx_shared")
+ endif()
if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
# Since we most likely do not have a mt.exe replacement, disable the
# manifest bundling. This allows a normal cmake invocation to pass which
@@ -256,8 +257,10 @@
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
OUTPUT_NAME "c++"
)
-
- list(APPEND LIBCXX_TARGETS "cxx_static")
+ list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+ if (LIBCXX_INSTALL_STATIC_LIBRARY)
+ list(APPEND LIBCXX_INSTALL_TARGETS "cxx_static")
+ endif()
# Attempt to merge the libc++.a archive and the ABI library archive into one.
if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
set(MERGE_ARCHIVES_SEARCH_PATHS "")
@@ -286,7 +289,7 @@
endif()
# Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_TARGETS})
+add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS})
if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
@@ -362,7 +365,7 @@
if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
set(experimental_lib cxx_experimental)
endif()
- install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49573.157170.patch
Type: text/x-patch
Size: 2930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180724/9995b635/attachment.bin>
More information about the cfe-commits
mailing list