Skip to content

Commit 0eafa66

Browse files
authored
Add --hip-link to target_id check
The new driver in clang does not automatically link against the HIP libraries, so we need to add a --hip-link option here to enforce linking. Otherwise we'll get an error on the link stem of check_cxx_compiler_flag() when calling with "-xhip" and "--offload-arch" Note: The link step isn't really needed for this use case, as invalid targets will fail the compilation step. But check_cxx_compiler_flag() performs both compiling and linking by default
1 parent 03bf7eb commit 0eafa66

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function(rocm_check_target_ids VARIABLE)
2121
foreach(_target_id ${PARSE_TARGETS})
2222
_rocm_sanitize_target_id("${_target_id}" _result_var)
2323
set(_result_var "COMPILER_HAS_TARGET_ID_${_result_var}")
24+
set(CMAKE_REQUIRED_LINK_OPTIONS "--hip-link")
2425
check_cxx_compiler_flag("-xhip --offload-arch=${_target_id}" "${_result_var}")
2526
if(${_result_var})
2627
list(APPEND _supported_target_ids "${_target_id}")

0 commit comments

Comments
 (0)