File llvm-do-not-install-static-libraries.patch of Package rocm-llvm
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 75b0080f6..c20abd7d6 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -116,12 +116,15 @@ macro(add_clang_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries)
- install(TARGETS ${lib}
- COMPONENT ${lib}
- ${export_to_clangtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ if (ARG_SHARED OR ARG_MODULE)
+ install(TARGETS ${lib}
+ COMPONENT ${lib}
+ ${export_to_clangtargets}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
+ endif()
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${lib}
@@ -131,7 +134,6 @@ macro(add_clang_library name)
set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${lib})
endif()
- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
else()
# Add empty "phony" target
add_custom_target(${lib})
diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake
index 2ee066b41..f1c5846b0 100644
--- a/lld/cmake/modules/AddLLD.cmake
+++ b/lld/cmake/modules/AddLLD.cmake
@@ -15,19 +15,20 @@ macro(add_lld_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
get_target_export_arg(${name} LLD export_to_lldtargets)
- install(TARGETS ${name}
- COMPONENT ${name}
- ${export_to_lldtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
-
+ if (ARG_SHARED)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
+ endif(ARG_SHARED)
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
endif()
- set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
endif()
endmacro(add_lld_library)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c3..7a1aa836e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -882,11 +882,14 @@ macro(add_llvm_library name)
endif()
get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
- install(TARGETS ${name}
- ${export_to_llvmexports}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
+ if(ARG_SHARED OR ARG_MODULE OR NOT LLVM_BUILD_LLVM_DYLIB)
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -894,7 +897,6 @@ macro(add_llvm_library name)
COMPONENT ${name})
endif()
endif()
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
if (ARG_MODULE)
set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake
index df541eecc..bfbccea86 100644
--- a/polly/cmake/polly_macros.cmake
+++ b/polly/cmake/polly_macros.cmake
@@ -42,15 +42,17 @@ macro(add_polly_library name)
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
endif( LLVM_LINK_COMPONENTS )
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
- install(TARGETS ${name}
- COMPONENT ${name}
- EXPORT LLVMExports
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
- add_llvm_install_targets(install-${name}
- COMPONENT ${name})
+ if (MODULE OR SHARED_LIBRARY OR NOT LLVM_BUILD_LLVM_DYLIB)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ EXPORT LLVMExports
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ add_llvm_install_targets(install-${name}
+ COMPONENT ${name})
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
endif()
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endmacro(add_polly_library)
macro(add_polly_loadable_module name)
diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index 9780f24d5..7481b0c85 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -109,7 +109,7 @@ endif()
# It depends on all library it needs, such that with
# LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as
# well.
-target_link_libraries(Polly PUBLIC
+target_link_libraries(Polly PRIVATE
${ISL_TARGET}
)
@@ -130,7 +130,7 @@ else ()
# to be already available in the address space the module is loaded into.
# Adding them once more would have the effect that both copies try to register
# the same command line options, to which LLVM reacts with an error.
- target_link_libraries(LLVMPolly PUBLIC ${ISL_TARGET})
+ target_link_libraries(LLVMPolly PRIVATE ${ISL_TARGET})
set_target_properties(LLVMPolly
PROPERTIES