From 4ce3e0c31ad6e40ee744fb879eeed2d3f3d0162a Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 4 Nov 2016 21:55:23 +0000 Subject: cmake: When using LLVM_DISTRIBUTION_COMPONENTS, adjust LLVMExports accordingly This Makes sure we only export targets that we're distributing, since cmake will fail to import the file otherwise due to missing targets. llvm-svn: 286024 --- llvm/cmake/modules/AddLLVM.cmake | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'llvm/cmake/modules/AddLLVM.cmake') diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 238b8810f42..3dcbabe4d20 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -584,10 +584,15 @@ macro(add_llvm_library name) set(install_type ARCHIVE) endif() + if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) + set(export_to_llvmexports EXPORT LLVMExports) + endif() + install(TARGETS ${name} - EXPORT LLVMExports - ${install_type} DESTINATION ${install_dir} - COMPONENT ${name}) + ${export_to_llvmexports} + ${install_type} DESTINATION ${install_dir} + COMPONENT ${name}) if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-${name} @@ -618,10 +623,16 @@ macro(add_llvm_loadable_module name) else() set(dlldir "lib${LLVM_LIBDIR_SUFFIX}") endif() + + if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) + set(export_to_llvmexports EXPORT LLVMExports) + endif() + install(TARGETS ${name} - EXPORT LLVMExports - LIBRARY DESTINATION ${dlldir} - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) + ${export_to_llvmexports} + LIBRARY DESTINATION ${dlldir} + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endif() set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) endif() @@ -797,8 +808,13 @@ macro(add_llvm_tool name) if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) if( LLVM_BUILD_TOOLS ) + if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) + set(export_to_llvmexports EXPORT LLVMExports) + endif() + install(TARGETS ${name} - EXPORT LLVMExports + ${export_to_llvmexports} RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} COMPONENT ${name}) -- cgit v1.2.3