[PATCH] D49587: [CMake] Support exporting runtimes using the CMake export
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 15:15:51 PDT 2019
phosek updated this revision to Diff 195636.
phosek marked 3 inline comments as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D49587/new/
https://reviews.llvm.org/D49587
Files:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
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
@@ -114,6 +114,9 @@
# Remove the -nostdlib++ option we've added earlier.
string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ ${PACKAGE_VERSION})
+
# This can be used to detect whether we're in the runtimes build.
set(RUNTIMES_BUILD ON)
@@ -203,6 +206,15 @@
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()
+ export(EXPORT LLVMRuntimes 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
@@ -152,7 +152,7 @@
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)
endif()
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -231,7 +231,7 @@
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
)
Index: libcxx/lib/CMakeLists.txt
===================================================================
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -344,7 +344,7 @@
if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
set(experimental_lib cxx_experimental)
endif()
- install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${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
)
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -300,6 +300,7 @@
endif()
endif()
install(TARGETS ${libname}
+ EXPORT LLVMRuntimes
ARCHIVE DESTINATION ${install_dir_${libname}}
${COMPONENT_OPTION}
LIBRARY DESTINATION ${install_dir_${libname}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49587.195636.patch
Type: text/x-patch
Size: 3414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190417/e4b68086/attachment.bin>
More information about the llvm-commits
mailing list