set(target_name cuda)

# Headers and SRC
file(GLOB_RECURSE BUILD_SRC *.cu *.h)
file(GLOB install_list *.h *.hpp)

# Binary targets
cuda_add_library(${target_name} ${BUILD_SRC})
set_target_properties(cuda PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCHITECTURES})
tbp_set_cuda(${target_name})

# begin_link_order
if(WITH_CUDA)
    target_link_libraries(${target_name} ${CUDA_LINK_LIBRARIES_KEYWORD} base)
endif()
# end_link_order

#install target ${target_name}
install(
    TARGETS ${target_name}
    EXPORT tbplasTargets
    LIBRARY DESTINATION ${TBPLAS_LIB_INSTALL_PATH}
    ARCHIVE DESTINATION ${TBPLAS_LIB_ARCHIVE_INSTALL_PATH}
    DESTINATION ${TBPLAS_LIB_ARCHIVE_INSTALL_PATH})


# TODO: header files installation
install(
    FILES ${install_list}
    DESTINATION ${TBPLAS_INCLUDE_INSTALL_PATH}/${target_name}
    PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
)
