Skip to content

Commit

Permalink
cmake: Don't try to install exports if there aren't any
Browse files Browse the repository at this point in the history
When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286209 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bogner committed Nov 8, 2016
1 parent 8fc9b4d commit adbd909
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ macro(add_llvm_library name)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_llvmexports EXPORT LLVMExports)
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
endif()

install(TARGETS ${name}
Expand Down Expand Up @@ -627,6 +628,7 @@ macro(add_llvm_loadable_module name)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_llvmexports EXPORT LLVMExports)
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
endif()

install(TARGETS ${name}
Expand Down Expand Up @@ -811,6 +813,7 @@ macro(add_llvm_tool name)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_llvmexports EXPORT LLVMExports)
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
endif()

install(TARGETS ${name}
Expand Down
7 changes: 5 additions & 2 deletions cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ configure_file(
@ONLY)

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
COMPONENT cmake-exports)
get_property(llvm_has_exports GLOBAL PROPERTY LLVM_HAS_EXPORTS)
if(llvm_has_exports)
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
COMPONENT cmake-exports)
endif()

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
Expand Down

0 comments on commit adbd909

Please sign in to comment.