From 0604a66dbc3e94947029425210fac5b824ca5907 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Thu, 25 Feb 2021 23:38:15 -0500 Subject: [PATCH] SWDEV-274307 - Send NVCC_OPTIONS to linker Flags of NVCC_OPTIONS need be sent to linker. Because compiler and linker flager are mixed in NVCC_OPTIONS. Change-Id: I3db37b962808566ea145e3cbdefa66d373e2d360 [ROCm/hip commit: 2152cc1b3d3676013168c47a908c3d9a0bb38b15] --- projects/hip/cmake/FindHIP.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/hip/cmake/FindHIP.cmake b/projects/hip/cmake/FindHIP.cmake index b69b19399e..27b2d254f6 100644 --- a/projects/hip/cmake/FindHIP.cmake +++ b/projects/hip/cmake/FindHIP.cmake @@ -668,6 +668,14 @@ macro(HIP_ADD_EXECUTABLE hip_target) else() add_executable(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) endif() + #LINK_OPTIONS + if("${HIP_COMPILER}" STREQUAL "nvcc") + # Some arch flags need be sent to linker. _nvcc_options mixes compiling and linker flags. + string(REPLACE ";" " " _nvcc_flags "${_nvcc_options}") # Replace ',' with space + if(NOT "x${_nvcc_flags}" STREQUAL "x") + set_target_properties(${hip_target} PROPERTIES LINK_FLAGS "${_nvcc_flags}") + endif() + endif() set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE HIP) # Link with host if (HIP_HOST_INTERFACE)