[libcxx-commits] [PATCH] D49587: [CMake] Support exporting runtimes using the CMake export
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 6 19:18:27 PST 2019
phosek updated this revision to Diff 185694.
phosek added a reviewer: smeenai.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D49587/new/
https://reviews.llvm.org/D49587
Files:
libcxx/lib/CMakeLists.txt
libcxxabi/src/CMakeLists.txt
libunwind/src/CMakeLists.txt
llvm/runtimes/CMakeLists.txt
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -117,6 +117,9 @@
include(AddLLVM)
include(HandleLLVMOptions)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ ${PACKAGE_VERSION})
+
set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${SAFE_CMAKE_REQUIRED_LIBRARIES})
@@ -208,6 +211,17 @@
endif()
endif()
+ if(LLVM_RUNTIMES_TARGET)
+ set(LLVM_RUNTIMES_FILE ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/LLVMRuntimes.cmake)
+ else()
+ set(LLVM_RUNTIMES_FILE ${LLVM_BINARY_DIR}/runtimes/LLVMRuntimes.cmake)
+ endif()
+ get_property(LLVM_RUNTIMES GLOBAL PROPERTY LLVM_RUNTIMES)
+ export(TARGETS ${LLVM_RUNTIMES} FILE ${LLVM_RUNTIMES_FILE})
+
+ install(EXPORT LLVMRuntimes
+ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}
+ COMPONENT cmake-exports)
else() # if this is included from LLVM's CMake
include(LLVMExternalProjectUtils)
Index: libunwind/src/CMakeLists.txt
===================================================================
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -177,9 +177,10 @@
add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
if (LIBUNWIND_INSTALL_LIBRARY)
- install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
+ install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} EXPORT LLVMRuntimes
LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
+ set_property(GLOBAL APPEND PROPERTY LLVM_RUNTIMES ${LIBUNWIND_INSTALL_TARGETS})
endif()
if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -251,10 +251,11 @@
add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
if (LIBCXXABI_INSTALL_LIBRARY)
- install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
+ install(TARGETS ${LIBCXXABI_INSTALL_TARGETS} EXPORT LLVMRuntimes
LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
)
+ set_property(GLOBAL APPEND PROPERTY LLVM_RUNTIMES ${LIBCXXABI_INSTALL_TARGETS})
endif()
if (NOT CMAKE_CONFIGURATION_TYPES AND LIBCXXABI_INSTALL_LIBRARY)
Index: libcxx/lib/CMakeLists.txt
===================================================================
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -98,7 +98,9 @@
if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
add_interface_library(unwind_shared)
elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
- add_interface_library(unwind_static)
+ if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER)
+ add_interface_library(unwind_static)
+ endif()
else()
add_interface_library(unwind)
endif()
@@ -413,10 +415,11 @@
if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
set(experimental_lib cxx_experimental)
endif()
- install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib}
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib} EXPORT LLVMRuntimes
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
)
+ set_property(GLOBAL APPEND PROPERTY LLVM_RUNTIMES ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib})
# NOTE: This install command must go after the cxx install command otherwise
# it will not be executed after the library symlinks are installed.
if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49587.185694.patch
Type: text/x-patch
Size: 4081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190207/c7129abb/attachment.bin>
More information about the libcxx-commits
mailing list