diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -2355,9 +2355,12 @@ endif() # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not - # building for macOS or Windows, as those two platforms seemingly require it. + # building for macOS, Windows or AIX, as those three platforms seemingly + # require it. + # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF + # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required. if("${CMAKE_BUILD_RPATH}" STREQUAL "") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|Windows") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|Windows|AIX") set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON) else() set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")