Index: cmake/modules/AddLLVM.cmake =================================================================== --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -1346,15 +1346,15 @@ set_property(TARGET ${name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ") endif() + else() + set(_install_rpath ${CMAKE_INSTALL_RPATH}) endif() else() return() endif() - if(DEFINED _install_rpath) - set_target_properties(${name} PROPERTIES - BUILD_WITH_INSTALL_RPATH On - INSTALL_RPATH "${_install_rpath}" - ${_install_name_dir}) - endif() + set_target_properties(${name} PROPERTIES + BUILD_WITH_INSTALL_RPATH On + INSTALL_RPATH "${_install_rpath}" + ${_install_name_dir}) endfunction()