diff --git a/projects/hip-tests/catch/CMakeLists.txt b/projects/hip-tests/catch/CMakeLists.txt index e8abe8f038..0bc5231260 100644 --- a/projects/hip-tests/catch/CMakeLists.txt +++ b/projects/hip-tests/catch/CMakeLists.txt @@ -109,16 +109,19 @@ if(NOT DEFINED OFFLOAD_ARCH_STR AND EXISTS "${ROCM_PATH}/bin/rocm_agent_enumerat RESULT_VARIABLE ROCM_AGENT_ENUM_RESULT) # Trim out gfx000 string(REPLACE "gfx000\n" "" HIP_GPU_ARCH ${HIP_GPU_ARCH}) - string(LENGTH ${HIP_GPU_ARCH} HIP_GPU_ARCH_LEN) - - # If string has more gfx target except gfx000 - if(${HIP_GPU_ARCH_LEN} GREATER_EQUAL 1) - string(REGEX REPLACE "\n" ";" HIP_GPU_ARCH_LIST "${HIP_GPU_ARCH}") - set(OFFLOAD_ARCH_STR "") - foreach(_hip_gpu_arch ${HIP_GPU_ARCH_LIST}) - set(OFFLOAD_ARCH_STR " ${OFFLOAD_ARCH_STR} --offload-arch=${_hip_gpu_arch} ") - endforeach() - message(STATUS "Using offload arch string: ${OFFLOAD_ARCH_STR}") + if (NOT HIP_GPU_ARCH STREQUAL "") + string(LENGTH ${HIP_GPU_ARCH} HIP_GPU_ARCH_LEN) + # If string has more gfx target except gfx000 + if(${HIP_GPU_ARCH_LEN} GREATER_EQUAL 1) + string(REGEX REPLACE "\n" ";" HIP_GPU_ARCH_LIST "${HIP_GPU_ARCH}") + set(OFFLOAD_ARCH_STR "") + foreach(_hip_gpu_arch ${HIP_GPU_ARCH_LIST}) + set(OFFLOAD_ARCH_STR " ${OFFLOAD_ARCH_STR} --offload-arch=${_hip_gpu_arch} ") + endforeach() + message(STATUS "Using offload arch string: ${OFFLOAD_ARCH_STR}") + endif() + else() + message(STATUS "ROCm Agent Enumurator found no valid architectures") endif() endif()