FindHIP: Apply remove_item on non-empty lists only

Change-Id: Ib7fcb992d7e1bb679d4d86676fe3d980ba204815


[ROCm/clr commit: 137c04c536]
This commit is contained in:
Maneesh Gupta
2017-04-18 10:21:20 +05:30
vanhempi 41b7984cd0
commit 710efeea0c
@@ -514,7 +514,9 @@ macro(HIP_ADD_EXECUTABLE hip_target)
# Separate the sources from the options
HIP_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _hipcc_options _hcc_options _nvcc_options ${ARGN})
HIP_PREPARE_TARGET_COMMANDS(${hip_target} OBJ _generated_files _source_files ${_sources} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options})
list(REMOVE_ITEM _sources "${_source_files}")
if(_source_files)
list(REMOVE_ITEM _sources ${_source_files})
endif()
if("x${HCC_HOME}" STREQUAL "x")
set(HCC_HOME "/opt/rocm/hcc")
endif()
@@ -530,7 +532,9 @@ macro(HIP_ADD_LIBRARY hip_target)
# Separate the sources from the options
HIP_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _hipcc_options _hcc_options _nvcc_options ${ARGN})
HIP_PREPARE_TARGET_COMMANDS(${hip_target} OBJ _generated_files _source_files ${_sources} ${_cmake_options} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options})
list(REMOVE_ITEM _sources "${_source_files}")
if(_source_files)
list(REMOVE_ITEM _sources ${_source_files})
endif()
add_library(${hip_target} ${_cmake_options} ${_generated_files} ${_sources})
set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE ${HIP_C_OR_CXX})
endmacro()