Revert "Revert "[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries.""

This reverts commit 21c008d5a5 since
it broke the build on macOS and Windows with the following error:

  The install of the clang_rt.<na,e> target requires changing an
  RPATH from the build tree, but this is not supported with the Ninja
  generator unless on an ELF-based platform.  The
  CMAKE_BUILD_WITH_INSTALL_RPATH variable may be set to avoid this relinking
  step.
This commit is contained in:
Petr Hosek 2021-06-22 16:11:29 -07:00
parent 6a40bb01f6
commit 959dbd1761
1 changed files with 3 additions and 0 deletions

View File

@ -359,6 +359,9 @@ function(add_compiler_rt_runtime name type)
target_link_libraries(${libname} PRIVATE ${builtins_${libname}})
endif()
if(${type} STREQUAL "SHARED")
if(COMMAND llvm_setup_rpath)
llvm_setup_rpath(${libname})
endif()
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")